Opposed to the expansion of slavery, Hamlin broke with his party to oppose the Kansas-Nebraska Bill (1854), and in 1856 he abandoned the Democratic party altogether. Converting at once to the new Republican party, he won the Maine governorship by a huge margin in a rousing contest. He served only a few weeks as governor, however, before the legislature returned him to the U.S. Senate early in 1857…During his second year in the Senate, Hamlin had become chairman of the Committee on Commerce. Shipping, customs and revenue, river and harbor improvements, and other commercial matters were grist for his mill. He also championed the rights of American fishermen throughout the 1850s. Giving up his chairmanship upon conversion to the Republican party was one of the great disappointments of his public career. Hamlin also supported the transcontinental railroad. He bitterly attacked southern dominance in national affairs, as exemplified by the James Buchanan administration's endorsement of the Dred Scott decision and the Lecompton Constitution. Hamlin prided himself on being a "working" rather than a "talking" senator and proved especially adept at rounding up jobs and other patronage favors for Maine supporters, at least until he broke with the Democrats.
In 1860 the Republican National Convention nominated Senator Hamlin for vice president. The former Democrat from Maine balanced nicely the former Whig from Illinois, and Hamlin was perceived as a supporter of William H. Seward (incorrectly, since he feared the N.Y. senator would lose the election), with many delegates eager to offer a consolation prize to the disappointed Sewardites.