Following the resignation of Robert Heaton Rhodes from his seat in the New Zealand parliament, William Montgomery contested the 20 April 1874 by-election against Walter Pilliet. The results were 168 and 76 votes, respectively, i.e., a margin of 92 for Montgomery. He thus entered parliament during the 5th term.
In July 1874, a select committee declared Montgomery's election to be "null and void", as he had a contract for the supply of railway sleepers with the general government in breach of election rules. The select committee accepted that the breach was inadvertent.[1] Montgomery stood for re-election in the second by-election, on 10 August 1874[2] and was returned unopposed.[3]