John Adams became president by a margin of three votes, I believe. Here is what Adams had to say:
If the way to do good to my country were to render myself popular, I could easily do it. But extravagant popularity is not the road to public advantage.