I am not an expert on either the history of the Ottoman Empire or Persia, but I found this paragraph from the Wikipedia article on the Battle of Vienna to be very interesting...
So, what if the Shah, reasoning that this will be his best country's shot of taking back Baghdad for a while, had decided to throw military and geopolitical caution to the wind and launched an invasion of Ottoman territory in the immediate aftermath of their defeat in Europe? Knowing the respective strengths of each army at the time, who is most likely to win such a war, and what impact might it have upon both countries? Furthermore, might Turkish preoccupation elsewhere encourage the Holy League and other parties in Christian Europe to press their post-Vienna advantage even further, and could they be even more successful in rolling back Ottoman territory in Europe?
The Ottoman defeat at Vienna sparked great celebrations in Safavid Iran; the report was apparently brought in such a spectacular way, that then incumbent King (Shah) Suleiman I (r. 1666–1694) considered a march to Baghdad, which had been lost in 1639 to the Ottomans by virtue of the Treaty of Zuhab.[40] Ultimately, the Safavids did not conduct a new campaign, for concerned state officials (notably the dominant eunuch faction within the royal court) were aware of the decline in Safavid military strength, and thus did not consider it prudent.[40] The eunuchs, according to Professor Rudi Matthee "were not against the idea of having the Ottomans suffer some humiliation, but they did not want their power destroyed for fear that this would remove a buffer against Christian Europe".[40]
So, what if the Shah, reasoning that this will be his best country's shot of taking back Baghdad for a while, had decided to throw military and geopolitical caution to the wind and launched an invasion of Ottoman territory in the immediate aftermath of their defeat in Europe? Knowing the respective strengths of each army at the time, who is most likely to win such a war, and what impact might it have upon both countries? Furthermore, might Turkish preoccupation elsewhere encourage the Holy League and other parties in Christian Europe to press their post-Vienna advantage even further, and could they be even more successful in rolling back Ottoman territory in Europe?