I'm not an expert either, and I asked the same question about China and Iran. Certainly they couldn't care less about Iran, right? Indeed, doesn't Iran's Islamic militancy encourage seperatists in both Russia and China??
I think it comes down to 1) basic Anti-Americanism and fear of US hegemony. 2) "the USA's loss is my gain" sort of thinking 3) fear that any change in Iran's Gov't will put them into a US "orbit." 4) need for "independent" energy suppliers able to poke the West in the eye.
The other thing I heard some expert saying once was that Russia’s policy seems to be to keep all of the Middle Eastern states stirred up internally and against each other as a way of diverting Islamist attention away from them.