Romney was running against a sitting POTUS. McCain - a senator - lost to Obama, then also a senator.The only senator ever to defeat a governor for POTUS was Warren G. Harding in 1920. The governor he beat was, ironically, from the same state that Harding was from - Ohio.
1920 was a terrible year for Democrats; the public was fed up with Woodrow Wilson and WWI.
No senator has ever unseated a sitting POTUS running for reelection.
Of course - it was McCain who lost to Obama the senator. Im getting my GOP losers reversed...