In February 1841, Dunlop's brother Robert died. Robert Dunlop had represented Huron in the assembly since 1835. The union of Upper and Lower Canada took place shortly after Robert's death. In the subsequent election later that year William ran against James McGill Strachan, the preferred candidate of the Canada Company. Strachan was the son of Bishop John Strachan, a leader of the Family Compact, and brother-in-law of Thomas Mercer Jones. Strachan lived and worked in York, while Dunlop was a local resident. Although Strachan had been thought to have little chance of winning, with one newspaper asserting that he had "...no more chance, than a stump-tailed ox in fly time," he was declared elected, by a majority of 10 votes (159 to 149). He took the seat and participated in the initial proceedings of the First Parliament.