It would have collapsed had they simply left, however Afghanistan wouldn't have been the defeat it was for the Russians either. I'd bet that if the Soviet leadership had a functioning crystal ball, and looked into the future to see what was set to happen, then they would definitely have left Afghanistan. They would have seen that adding such a nation ('place' is a better term)to their orbit wasn't worth the cost. And the thing is it is far easier to win a war than to occupy a nation (eg take the Ethiopian-Somalia scenario ....Ethiopia had, and will continue to, whoop the a$$e$ of the Islamic courts. However if they decide to stay in Somalia (which they said they will not) then you'd see the situation start to change as the cowardly Somalis resort to terrorist style attacks (although the Ethiopians are not as PC as we are, thus I think they would hit back and hit hard).
Now, the Soviet Union would still have collapsed even if they had never set foot in Afghanistan, but I think it might have taken longer and happened (for what its worth) with greater 'dignity.'