I think Putin is in Ahmadinejad's back pocket, or vice versa and that's why Ahmadinejad is so overly confident. I also think something is going to happen in the US that will either pull eyes away or create a situation where the US can't help Israel when Iran/Russia strikes.
I have wondered if his theatrics were a diversion for something else.