Wasn't Saddam an ally of Russia?
If Russia wasn't his ally, who was his ally?
Syria is looking like a strong ally of Russia as it was the case of Serbia. Russians played direct roles to save these countries.
Then what was in Saddam's mind?
This is an interesting question.
With the benefit of hindsight, "Russia" wasn't in a position to help Saddam Hussein in 1990-91 because the Soviet was about to implode.
The reason it probably didn't help Hussein in 2003 was that they didn't believe that President George Bush Jr. would invade Iraq; his father, Bush Sr., had declined to march on Baghdad after winning the Persian Gulf War.
But the Iraq war was a "wakeup" call to Russia; it didn't want Syria to be the next country to fall under American influence.
Russia was the ally of the socialist Baath party in Iraq, of which Saddam was a member. However, the Iran-Iraq war changed this allegiance. Since during the cold-war there were really only two poles (in military, economic, and ideological power), most countries allied with one or the other. This ultimately became a binary decision, as allying with one would require joining that ally's international "camp".
The Baath party in Iraq had initially been enthusiastic with the deposing of their enemy, the Shah of Iran, in 1979. However, when largely Shia Iran called for the overthrow of the minority Sunni-led Iraq, this sentiment obviously changed. The US obviously had their own animosity towards Iran as it had overthrown it's ally the Shah, and held Americans hostage. The US government was more than happy to supply Iraq with arms, including biological weapons, in their bloody fight with the Iranians. This lead to an alliance with the Americans at the expense of the Iraqi relationship with the Soviets.
While the Americans were hoping that both countries would demolish each other leading the way to weaker more controllable states, they would have much preferred the more secular government of Iraq to the anti-imperialist and militantly Islamic government of Iran. This is why after the war, the Americans continued to arm Iraq, despite Saddam using American chemical weapons to murder the rebellious Kurdish population.
Much of the reason that the Soviet Union did little to interfere in the 1980's was due to their weakening economic situation. When the first gulf war was initiated by the US in 1991, Russia was not in a position to resist. Furthermore, considering that the Americans were leading the global coalition to force Saddam out of Kuwait, any military assistance provided by the Russians could be seen in a negative light by the international community. Not to mention that any direct involvement would been seen as an act of war against the US, which would be very dangerous given the tenuous nuclear balance maintained between those countries.
Not to dismiss political philosophy, but pragmatism drives most behaviors in goverment-
The dynamics of the Cold War were such that every country outside of the Superpowers were strongly encouraged to take sides. If you were geographically close to one of them, you often didn't have a lot of choice who that was.
However, this opened oppertunity for the less ideologically rigid (and less scrupulous) to work both sides off each other to obtain the best deal. This is essentially what Hussein did in Iraq. While Iran was a staunch US ally, he took support from Russia. However, after the revolution in the 70's, he sensed an oppertunity and started taking support from the USA too. During the Iran/Iraq war, Hussein was essentially acting as a USA client to keep Iran busy. I believe the (stupid) idea of starting the war was entirely Hussein's, but once engaged it was definitely in the USA's interest that Iraq do as well as possible in it.
The problem with a country taking this Realpolitik attitude is when the day comes that you aren't particularly useful to either side, things can get ugly. This is what happened to Hussein after the Iran/Iraq war ended. It pays to develop real friends.
If we speak about the second Iraq war, Russia dealt with the case of Iraq the same way as it dealt with Syria. They opposed the invasion and did not allow the Iraq invasion in the Security Council, but the USA just bypassed the SC.
Russia had no power and/or willingness to prevent the Iraq invasion by military means as this would mean a direct military conflict with the USA.
Regarding the first invasion in Iraq under Bush the father, there was a pro-US leadership in the USSR at the time (1991) so they were unwilling and unable to oppose. Also Iraq at the time invaded Kuwait which provided a better pretext for international condemnation and the anti-Iraqi UN SC resolution.
Syria is one of the few places in which Russian technology is field tested against Western technology on a regular basis. For instance, other than North Korea, Syria has the most advanced anti-aircraft systems in the world. This is often put to the test with Israeli jets. In 2007 I think an Israeli jet did manage to penetrate the air defences, and just a few weeks ago a suspected Israeli jet was shot down (it later turned out to be Turkish).
Also, Syria has an important Russian Mediterranean naval base.