The election of 1876 was... weird, to say the least. The map was very different back then, so guess whether these states voted red, blue, or weren't even a state during the election of 1876.
Note that the ideology of politics was not the same then as it is today.
Rutherford B. Hayes (Rep) beat Samuel J. Tilden (Dem) by a singular electoral vote to take the presidency.