In March 1858 he resumed this office in Lord Derby's second administration, being returned to the House of Commons as member for Stamford. Again his tenure was brief, leaving office in July 1858. He was responsible for the Universities (Scotland) Act 1858, and in the same year he was elevated to the bench as Lord Justice Clerk, with the judicial title "Lord Glencorse". In 1867 he was made Lord Justice General of Scotland and Lord President of the Court of Session. He was made a Privy Counsellor in 1859, and awarded a Doctor of Civil Law (DCL) by the University of Oxford in 1859.