Irvine was educated at Edinburgh Academy and Oriel College, Oxford, where he was president of the Oxford Union in 1932. He became a barrister in 1935, when he was called by Middle Temple, and became secretary to the Lord Chief Justice 1935-40. He became Queen's Counsel in 1958  and recorder of Colchester in 1965.
In 1937, Irvine stood as a Liberal candidate at Bethnal Green North East in the London County Council elections.
In his first two unsuccessful parliamentary contests in Kincardine and West Aberdeenshire in 1935 and 1939, Irvine was a Liberal Party candidate, but later joined the Labour Party. After two further election defeats in Twickenham in 1945 and Aberdeen South in 1946, he was eventually elected Member of Parliament (MP) for Liverpool Edge Hill at the 1947 by-election.
Irvine became Solicitor General in 1967, when he was knighted and served till 1970. He became a privy councillor in the New Years Honours 1970.