Upon the recommendation and support of Benjamin Disraeli—the then-Chancellor of the Exchequer and future Prime Minister—Treeby stood for election as a Conservative for the corrupt borough Lyme Regis, where he had been buying properties for development, at the 1859 general election. During campaigning, Treeby bribed electors—who otherwise "taunted" him from having "risen for the people"—leading to a tie with his rival William Pinney, only settled when the local mayor added an additional vote to the Liberal candidate once polling had closed, blaming a "slow-running watch".[2][3]
Treeby remained in the constituency, purchasing Highcliffe House in Dorset and becoming the local squire. He stood for election again in 1868, with a platform of ridding the town's sewage problems for free, while also bribing electors with up to £100, and was elected.[2]
In Parliament, he loyally supported the Conservative Party, although he also rebelled on votes relating to parliamentary and local government franchises, siding with the Liberal and philosopher John Stuart Mill, both speaking for and voting for Mill's amendments. He also amended the Conservative Reform Act 1867 bill, requiring overseers of elections to publish lists of ratepayers in arrears and in danger of losing their right to vote. Yet, he also attempted to make public secret land deals between "resident country gentleman" and railway companies saw him rebuked by fellow Conservatives.[2]
Treeby later ended up at loggerheads with his former ally, Disraeli, when the 1868 Scottish Reform Bill saw an additional seat granted to Scotland at the expense of Lyme Regis, whose parliamentary representation was transferred to Dorset. Treeby was unseated and did not seek re-election elsewhere, ending his parliamentary career.[3][2]