Stanley was elected to the New South Wales Parliament as the Labor member for the new seat of Lakemba at the 1927 state election. In the three months prior to that election, the party leader and Premier Jack Lang had gained control of the party pre-selection process and ensured that his supporters were endorsed. The sitting Labor member for St George and Minister for Public Health, George Cann had been expected to contest the seat. However, he had supported a caucus move to depose Lang and had been expelled from the party. Cann contested the seat as an Independent Labor candidate but was easily defeated by Stanley. Stanley remained loyal to Lang until the early 1940s and was a member of Lang's breakaway parties the Australian Labor Party in 1936-1938 and the Australian Labor Party in 1940. Stanley retained Lakemba at the next seven elections. but did not hold party, parliamentary or ministerial office.
Resignation from the Labor Party
In November 1949, Jim Harrison resigned from the Legislative Council to successfully contest the federal seat of Blaxland at the 1949 election. His successor was due to be elected at a joint sitting of the two houses of state parliament on 22 March 1950. Although the election was by secret ballot, each Labor member of the parliament had a unique how-to-vote card, and Labor scrutineers were able to determine if a member had broken caucus solidarity and voted against the endorsed Labor candidate. On the day of the election, Asher Joel, a wealthy Sydney businessman, was a surprise nomination against Labor's Norman Thom. Although Joel was unsuccessful, he received 23 votes, and it became common knowledge within the Labor Party, although never officially stated, that four members of the party – Stanley, John Seiffert, Roy Heferen and James Geraghty – had voted for him. There were also unproven rumours that they had received cash payments for their votes. The state executive of the Labor Party responded by withholding their endorsement as candidates at the forthcoming 1950 election. Stanley and the other disendorsed members received support from the Caucus, and a significant rift developed between the parliamentary and extra-parliamentary sections of the party, which was a major factor in Labor's poor showing at the election. Stanley resigned from the party and spent the rest of the term as an Independent Labor member. He unsuccessfully contested the election against the endorsed Labor member Stan Wyatt. He then retired from public life.