Getting there
In 2002, we flew from Mashhad to Esfahan and then took the onward flight to Tehran. There are also intercity buses between Tehran and Esfahan.
Between Qom and Esfahan is a distance of 144 miles or 232 km, this suggests that a car/taxi trip between the two should be practical, for those people who are going to Qom anyway and who perhaps want to visit Mashhad from an airport other than the one in Tehran.
Rail to/from Tehran - there is a daily train (takes 7.5 hours).
Rail to/from Mashhad - daily (18.5 hours)
Sightseeing
Esfahan has a lot of sights within the city and the city is not very large, so you can see quite a lot of impressive material in a relatively short period of time. For example within Imam Square (also known as Naqsh-e-Jahan and Meidan Shah) you can find the Masjid Imam, Ali Qapu Palace and the Sheikh Lotf Allah Mosque.
Together with the associated shopping around the square, this ensemble can easily take a full day, depending on how much you want to haggle when shopping. If one of the carpet salespeople tempts you in, then that can take away a good portion of the day.
For the time pressed tourist I would recommend giving priority to Esfahan over Shiraz.