Truman's popularity sharply declined after becoming president in 1945, falling from 87% to 32% by 1946. In the 1946 midterm elections, Republicans gained control of both houses of Congress. Truman ran for re-election in 1948 against Republican Thomas Dewey and two third party candidates. Early polls showed Dewey leading, but Truman campaigned aggressively across the country. On election day, Truman defeated Dewey in an upset victory, becoming the first president to be elected after succeeding to the office upon the death of his predecessor.