Don't buy the hype, Iraq is locked down solid. There are still random nutjobs from neighboring countries that can't wait to die for Allah, but they're being helped as fast as they arrive. The Iraqis are done as an organized force, and the sporadic resistance from them is far less than from the out-of-towners.
We could leap into Syria or Iran right now, and Iraq would remain firmly under our control. We don't need to cut any deals with the mullahs. We're in no danger from them or from the soon to be extinct jihadists in Iraq.
Clearly there is a lot that isn't on the table, or things that don't quite add up, but assuming that we're cutting a deal with Iran because we're floundering in Iraq is flawed reasoning.