I mean, the major difference is that with the Afghanistan, the US troops just get to return back home after fighting in the disaster that Afghanistan has become. I think it would be a bit more different when you have nowhere else to come back to, other than the place you just unsuccessfully destabilized and ravaged.
The democratically elected leader was over thrown by the Communist party and the Soviets invaded to support the illegitimate communist government.
The US supported the anti-communist opposition, and the Soviets withdrew and Afghanistan returned to democratic elections.
Like all things politics, its all how you spin it. Perhaps the real loss was what happened after the US spent over $1T to spread democracy in Afghanistan, they began electing the Taliban as their democratic leaders, and we ultimately went to war against the Taliban costing even more. That firmly established the US believes in democracy so long as we also support the party that wins the elections.
Well the Taliban is no longer in power, removing them from power was the purpose of our use of force and military operations in Afghanistan starting in 2001...again when it comes to war "winning" is kind of in the eye of the beholder.
FYI we spent over $1T to spread democracy in Afghanistan pre-2001.