The Iranian government has problems that they can't solve internally. Al Qaeda hates the apostate Shias with a rage that will not be quenched. We don't read about the Islamist terror attacks in Iran, but they happen every week. The Kurdish tribes are as much a pain in the rear for Iran as they are for the Turks. Iran can be extremely schizoid when it comes to tribal versus cosmopolitan attitudes. Much like Yugoslavia in the '80s the country is a series of almost European city states surrounded by a rural peasantry who's lives haven't changed much since the sixteenth century. This split causes a lot of stress on Iranian society, and they use the theocracy to keep a lid on.
Any problem Pakistan has with the Northern tribal areas it doesn't have anything on the Iranian problems with Baluchistan, an Arizona sized nebulous tribal regional wasteland dominated by ungovernable clans straddling the Pakistani and Iranian border. Sound familiar?
Iran has things we want, and we have things they need. Surly two cultures of traders can come to a mutually advantageous compromise.