I'm not politically adept, but in 1864, Marylanders were voting on an entirely new state constitution - only one part of it pertained to abolishing slavery. 30,174 voted in favor of it and 29,799 against (50.31% to 49.69%).
Also, correct me if I'm wrong, but I believe that some of the votes in the 1864 general election were padded a bit by Union forces who were allowed to vote in Maryland even though they were not citizens of the state. Gee, imagine fraudulent voting being allowed!