Cockburn entered the Faculty of Advocates in 1800, and attached himself, not to the party of his relatives, who could have afforded him most valuable patronage, but to the Whig party, and that at a time when it held out few inducements to men ambitious of success in life. He became a distinguished advocate, and ultimately a judge. He was one of the leaders of the Whig party in Scotland in its days of darkness prior to the Reform Act of 1832, and was a close friend of Sir Thomas Dick Lauder. He was the defence lawyer for Helen McDougal, Burke's wife, in the trial for the Burke and Hare murders, and won her acquittal.