When America throws support behind any foreign group (the "lesser of two evils" in most cases) we take a chance that they will eventually turn on us or become worse than the group that we originally opposed.
Hindsite is 20/20. We should rember that countries do not have friends, they have interests. I still think that in 1980, the Soviet Union was a bigger threat than Osama bin Laden is now. I think the Taliban's actions show that they have little loyalty to those who have assisted them in the past. Also, the Taliban was just one of several factions that the US supported through Pakistan. The defeat inflicted on the Soviet military in Afghanistan was a major factor leading to the complete collapse of the Soviet Union.
Perhaps one of the most important lessons of history is that it is the unintended consequence of actions can be as important as the intended ones. After all in 1917, the German Government sent a sealed train carrying Lenin to Russia. Their reason for doing this despite their knowledge of Lenin's radical politics was to replace the Russian government with one that would agree to an armistice. The Germans hoped that they could remove Russia from the war and move their armies on the eastern front to the western front before American armed forces could join the fight in France. Germany lost the bet, but we had to deal with the Soviet Union for the next 74 years.