That "we were still subsidizing those same terrorists" bit causes me to reflexively facepalm every time I think about it.
Another example of shifting alliances: During the Iran vs. Iraq war, the US and other Western countries were subsidizing Saddam Hussein, since Iraq was considered the lesser of two evils (they had not taken US diplomats hostage as the Iranians had). Everyone looked the other way when the Iraqis used chemical weapons on the Iranians. When Iraq invaded Kuwait, they became an enemy of the US because they were threatening US oil suppliers. At the present time, the Iraqi government is again a friend of the US. In a few years, things could change again.