I have to go with James K. Polk. He expanded the country dramatically, yet never gets any credit for it.
He expanded our country by conquering territory from a sovereign nation that had committed no act of aggression against the U.S., backed by slave-owners who wanted to spread slavery to the West. Morally, at least, he is one of the worst presidents we've ever had.
Among the most underrated presidents, I'd go for Grover Cleveland, Ulysses Grant, Warren Harding, or Calvin Coolidge. Unfairly, Harding and Grant are only remembered because of their administrations' scandals, but they did accomplish important archievements that do not deserve to be ignored, Harding in the economy and Grant by protecting blacks' civil rights. Cleveland stood up to imperalists and protectionists, and Coolidge presided over a period of great economic prosperity generated by his (and Harding's) free-market policies.