 In 1865, Thomas was elected as an Unconditional Unionist to the Thirty-ninth Congress to fill the vacancy caused by the resignation of Edwin H. Webster and served from December 4, 1865 to March 3, 1867.He was an unsuccessful Republican candidate for reelection in 1866 to the Fortieth Congress.After Congress, he served as collector of the port of Baltimore from 1869 to 1873 and again from 1877 to 1882.