While Maryland voted for the National Republican candidate, Henry Clay, over the Democratic Party candidate, Andrew Jackson, by a mere four votes, this is irrelevant because electors weren't awarded based on the statewide vote. They were chosen in four district elections. A total of ten electoral votes were allocated, with five going to Clay and three to Jackson, while two electors failed to cast votes. In terms of raw votes cast, Clay's four-vote margin is the smallest between two major candidates in any state in any presidential election in United States history. This is the only time a Democrat won re-election without carrying the state's popular vote either time.
^Two electors failed to cast their votes for Henry Clay. Otherwise, he would have had 7 electoral votes.