The answer: James Buchanan. (http://en.wikipedia.org/wiki/James_Buchanan) He was our last president before Lincoln.
Probably because it was very unusual to be a lifelong bachelor at the time, some of Buchanan's contemporaries suspected he was gay -- mostly because Buchanan had a long-term relationship with fellow politician William Rufus King that was so intimate (both men were described as "effeminate" and "eccentric") that it was hard to view it as normal. There was a lot of gossip about it, anyway. (The real problem was that Buchanan, a Northerner, adopted many of the same political positions as King, a Southerner. This didn't sit well with the increasingly abolitionist electorate.)
Buchanan is ranked as one of our worst presidents -- but not because of the gay rumors. He's generally faulted for not being able to prevent the Civil War. Which I think is kind of unfair; the tensions leading to the war arose decades before Buchanan took office. By midcentury, I doubt Lincoln himself could have prevented the War.
(Still, I wonder if the whole "candidates need to have a nuclear family" thing arose from the fact that after the devastating War, no candidate wanted to do ANYTHING that might remind voters of the despised Buchanan. By the time people forgot about Buchanan, it had become established as a cliche.)
Ironically, Lincoln was later suspected -- controversially -- with being gay himself. (https://en.wikipedia.org/wiki/Sexuality_of_Abraham_Lincoln)