Define victory. The problem with defeating Afghans is not that they are undefeatable, it's the fact that they are ungovernable, making any military victory moot since victor can't reap the benefits.
They were but they were beginning to run out of money and enthusiasm. Even they were suffering from too many bodybags going home. Even without the stingers they would have given up in another couple of years.
Actually decission to withdraw has been made fairly early, 1984 or 85, before stingers (or any other significant aid) started showing up. Gorby (you know, the winner of Nobel Peace Prize) wanted to get some sort of peace with honour so he decided to inflict as big defeat as he could.
What Soviets could do on military front.
More troops. Soviet contingent was small to begin with from which you have to subtract troops guarding road convoys, guarding military instalations and sick any you were left with precious few who could be used for offensive sweeps.
Better leadership. Soviets went through the period of dying leaders at crucial point, where leadership with vision was needed. Avoid that so after Brezhnev dies you get somebody who can stay in saddle for a while and who actually has an idea what he wants to do.
Combined with above faster switch to mobile, heliborne sweeps as opposed to initial slow armoured/mechanised sweeps. Though that becomes problematic once MANPADS show up so Soviets need to do it fast, before Reagan decides to increase aid. Reducing violence to low(er) levels could mean Us sticks to low level aid as Mujahedeen are seen as lost cause.
However all this doesn't automatically lead to "victory" as Soviets would still be unable to "win" in classical sense.