On 23 September 1782, Thomas Swinnerton Dyer, just a month short of his twelfth birthday, went to Portsmouth and joined Union as a captain's servant. He saw action almost immediately. Three years earlier, with Britain isolated and distracted by the rebellion in the American colonies, Spanish forces had besieged the British garrison at Gibraltar. In both 1780 and 1781, British fleets had forced their way through the Spanish and French blockade and delivered much-needed supplies. Dyer, on board Union, was part of the third and largest British resupply effort. The garrison had just fended off the most serious assault to date, and the Admiralty wanted to ensure that the garrison was strong enough to deter any further Spanish and French attempts. Dyer played only the smallest part in the relief of Gibraltar, but it was a formative experience for him. Less than three weeks into his naval career, he survived a large storm that scattered the blockading Spanish and French squadrons. He also survived his first fleet action, the indecisive battle of Cape Spartel. After delivering the troops and supplies, the British fleet was briefly engaged with the Spanish blockading squadron before relying on their superior sailing qualities to return to Britain.
Upon his return, Dyer undoubtedly boasted to all his friends that he was now an experienced sea-dog, having survived a storm and a battle. He had many more ahead of him. His initial rating of captain's servant was somewhat misleading. As he wrote many years later, he was in fact a ‘young gentleman’ destined for command. Over the course of the next decade, he served in eight ships under eight different captains as a captain's servant and a midshipman. He travelled to the West Indies and the Mediterranean, and endured the boredom of life on guard ships and at school. He served on Victory, which was one of the largest ships in the navy, and on the sloop Bulldog, which was among the smallest. In 1793, when the navy mobilised for war with France, he was commissioned as a lieutenant and joined Egmont.