Nah. If you don't win, you don't win. The Constitution is silent on the issue of political parties, and what do you do when there are multiple losing opponents? Would you really have wanted Governor Thurmond to go into the Senate after losing in 1948?
And what about those who didn't quite run but received electoral votes from faithless elector (so, technically, were "candidates")? A freaking Senator-for-life Walter B. Jones in 1956?
In theory, it could be the candidate with the second highest number of electoral votes.
The Vice Presidency was of course invented for exactly that purpose originally, as part of a compromise package between those who wanted the electoral college to choose the President and those who basically wanted it to draw up a shortlist for Congress to choose from.
REPEAL THE XIIth AMENDMENT!