This how I view it:
As a realist, I firmly believe that Pakistan should/is seeking out its interest first and foremost. That being said, to understand the conflict between us and the Iranians we have to look first at its root.
We had good relations with Iran until 79. Then they became a sectarian state(welayat alfaqih) that wanted to export its revolution, and that made Iran in a collision course with S.Arabia. With the start of the Iraq-Iran war, S.Arabia wholeheartedly supported Iraq, which made the Iranians much more hostile toward us and they started assassinations and the Hajj riots, as result we broke all relations with the country. During the 90's tensions declined and relations improved. Then came 9/11. The US took out Iran's closest enemies(Taliban & Saddam) which the Iranian government saw as a golden opportunity to expand and grow its influence in the ME, hoping to force S.Arabia into allowing Iranian"investment and extraction" of GCC oil and gas, which we would allow to happen without a fight. Again back to the collision course. Iraq, Syria, Lebanon and Hamas came under Iranian influence. So now we are at this pivotal moment in history during the Syrian revolution, If Bashar succeeds in crushing the Syrian people, then you can count on a Muslim World War happening in ME within the next few years. The fact is the region is very polarized at the moment, one of several things could trigger a wide conflict(e.g Sunni ethnic cleansing in Syria). However with Syria(and Lebanon by default) back to Arab camp(by toppling Bashar) it would indeed be a fatal blow to the Iranian agenda in the region and prevent a major conflict.
When it comes to Pakistan role in the conflict, lets not forget that 40% of world's oil supply comes out of the Arabian Gulf, and ANY country that holds a monopoly on it won't be beneficial to Pakistan(whether S.Arabia or Iran) as it would most certainly raise the price of exported oil despite the drop in price from eased tensions. Secondly, Iran is a big country, its a Shia sectarian country that borders Pakistan and Pakistan has a significant Shia population. So from a geopolitical stand point, Iran has the POTENTIAL of destabilizing Pakistan, and if for whatever reason that Pakistan gets in a conflict with Iran, then Pakistan would be literally surrounded with enemies from every direction(India, Iran and Afghanistan) which would be considered a strategic nightmare scenario for Pakistan. However, Saudis chilling in the desert don't have the capability to destabilize Pakistan even if they wanted too.
So, I am convinced that the current close relations between us and the Pakistanis are not as we say in S.Arabia(for the Blackness of our eyes) but came after careful readings of the geopolitical situation that the Pakistani policymakers found themselves in.