He remained out of parliament during the four eventful years from 1812 to 1816, which witnessed the termination of the war, and he did not conceal his resentment against the Whigs. But in the years he spent out of parliament occurrences took place which gave ample employment to his bustling activity, and led the way to one of the most important passages of his life. He had been introduced in 1809 to the princess of Wales (afterwards Queen Caroline). But it was not till 1812 that the princess consulted him on her private affairs, after the rupture between the prince regent and the Whigs had become more decided. From that time, Brougham, in conjunction with Samuel Whitbread, became one of the princess's chief advisers; he was attached to her service, not so much from any great liking or respect for herself, as from an indignant sense of the wrongs and insults inflicted upon her by her husband. Brougham strongly opposed her departure from England in 1814, as well as her return in 1820 on the accession of George IV.

In 1816 he had again been returned to parliament for Winchelsea, a borough of the earl of Darlington, and he instantly resumed a commanding position in the House of Commons. He succeeded in defeating the continuance of the income-tax; he distinguished himself as an advocate for the education of the people; and on the death of Romilly he took up with ardour the great work of the reform of the law. Nothing exasperated the Tory party more than the select committee which sat, with Brougham in the chair, in 1816 and the three following years, to investigate the state of education of the poor in the metropolis. But he was as far as ever from obtaining the leadership of the party to which he aspired. Indeed, as was pointed out by Lord Lansdowne in 1817, the opposition had no recognized efficient leaders; their warfare was carried on in separate courses, indulging their own tastes and tempers, without combined action. Nor was Brougham much more successful at the bar. The death of George III. suddenly changed this state of things. Queen Caroline at once, in April 1820, appointed Brougham her attorney-general, and Denman her solicitor-general; and they immediately took their rank in court accordingly; this was indeed the sole act of royal authority on the part of the unhappy queen.

In July Queen Caroline came from St Omer to England; ministers sent down to both Houses of Parliament the secret evidence which they had long been collecting against her; and a bill was brought into the House of Lords for the deposition of the queen, and the dissolution of the king's marriage. The defence of the queen was conducted by Brougham, assisted by Denman, Lushington and Wilde, with equal courage and ability. His conduct of the defence was most able, and he wound up the proceedings with a speech of extraordinary power and effect. The peroration was said to have been written and rewritten by him seventeen times. At moments of great excitement such declamation may be of value, and in 1820 it was both heard and read with enthusiasm. But to the calmer judgment of later generations this celebrated oration seems turgid and overstrained. Such immense popular sympathy prevailed on the queen's behalf, that the ministry did not proceed with the bill in the Commons, and the result was a virtual triumph for the queen.

This victory over the court and the ministry raised Henry Brougham at once to the pinnacle of fame. He shared the triumph of the queen. His portrait was in every shop window. A piece of plate was presented to him, paid for by a penny subscription of peasants and mechanics. He refused to accept a sum of £4000 which the queen herself placed at his disposal; he took no more than the usual fees of counsel, while his salary as Her Majesty's attorney-general remained unpaid, until it was discharged by the treasury after her death. But from that moment his fortune was made at the bar. His practice on the northern circuit quintupled. One of his finest speeches was a defence of a Durham newspaper which had attacked the clergy for refusing to allow the bells of churches to be tolled on the queen's death; and by the admission of Lord Campbell, a rival advocate and an unfriendly critic, he rose suddenly to a position unexampled in the profession. The meanness of George IV. and of Lord Eldon refused him the silk gown to which his position at the bar entitled him, and for some years he led the circuit as an outer barrister, to the great loss of the senior members of the circuit, who could only be employed against him.

His practice rose to about £7000 a year, but it was again falling off before he became chancellor.

It may here be mentioned that in 1825 the first steps were taken, under the auspices of Brougham, for the establishment of a university in London, absolutely free from all religious or sectarian distinctions. In 1827 he contributed to found the "Society for the Diffusion of Useful Knowledge" - an association which gave an immense impulse to sound popular literature. Its first publication was an essay on the "Pleasures and Advantages of Science" written by himself. In the following year (1828) he delivered his great speech on law reform, which lasted six hours, in a thin and exhausted House, - a marvellous effort, embracing every part of the existing system of judicature.

The death of Canning, the failure of Lord Goderich, and the accession of the duke of Wellington to power, again changed the aspect of affairs. The progress of the movement for parliamentary reform had numbered the days of the Tory government. At the general election of 1830 the county of York spontaneously returned Brougham to the new House of Commons as their representative. The parliament met in November. Brougham's first act was to move for leave to bring in a bill to amend the representation of the people; but before the debate came on the government was defeated on another question; the duke resigned, and Earl Grey was commanded by William IV. to form an administration.