In December, 1846, Thomas J. Barclay enlisted as a sergeant in the Westmoreland Guards, a militia company that was comprised of the sons of the local elite of Westmoreland County, Pennsylvania. Barclay represented an elite among the elite of the Guards, which were commanded by one of his uncles, John W. Johnston. Having been born into a wealthy, politically active family, Barclay, at age twenty one, was already well on his way to a successful career as an attorney, having been admitted to the county bar at eighteen. Nevertheless, he was only too glad to avail himself of the opportunity of new experiences by fighting in the Mexican War, and he fit right into the regiment in which nearly all of the officers, commissioned and non-commissioned, were drawn from the legal profession.
The Guards mustered into the federal service as Company E of the 2nd Pennsylvania Infantry in March, 1847, and began the journey down the Ohio and Mississippi to the embarkation point for Mexico, New Orleans. The regiment was immediately assigned to assist Winfield Scott's expedition on Vera Cruz, and from there, they entered into the series of campaigns designed to ensnare Mexico City. Following the battle of Cerro Gordo in April, they assisted in the occupation of Jalapa, and under Gideon J. Pillow, drove through Puebla in July, through the battles of Contreras and Churubusco in August, and finally arrived at the capital in September to force its capitulation. From that time until December, 1847, Barclay's regiment served as part of the occupation force.
Barclay was rewarded for his service in this campaign with a promotion to 2nd Lieutenant of the 11th U.S. Infantry on December 30, 1847. With the possible exception of the three months spent in occupation of the capital, his experience was uniformly hard, both in combat and camp. Between unpredictable citizens, unsanitary conditions, and unsavory characters, Barclay saw the worst of the army and of Mexico. In the winter of 1847-48, Barclay's regiment marched from Mexico City back to coast to prepare for demobilization. He resigned his commission in May, 1848, and returned to Pennsylvania, where he died in 1881.