Barret was elected to the State house of representatives in 1852 and served four terms. He became identified with the St. Louis Agricultural Society and organized its exhibitions. After defeating the incumbent Francis P. Blair, Jr. in 1858, he presented his credentials as a Democratic member-elect to the 36th Congress, but Blair contested the election. He served from March 4, 1859, to June 8, 1860, when Congress declared him not entitled to the seat on the grounds that there had been election irregularities (such as judges who'd not taken the oath, ineligible voters, ballots for Blair that should have been counted but weren't and a difficult to explain increase in voters in a few precincts) and declared Blair entitled to it.[2] Blair resigned 17 days later to set up a special election.
In a special election against Blair, Barret was subsequently sent again to the same Congress to fill the vacancy caused by Blair's resignation on June 25. Barret then served from December 3, 1860, to March 4, 1861. Blair successfully ran against him in the general election in 1860 for a seat in the 37th Congress. Barret moved to New York City and engaged in numerous occupations, eventually dying there on November 2, 1903. He was interred in Cave Hill Cemetery in Louisville, Kentucky.