The principle was used as early as late 1760s by Lagrange but are there any earlier uses of it in math?
I assume this refers to Lagrange's 1768 proof of the Diophantine approximation theorem. The proof was simplified by Dirichlet in 1842, using the idea twice. He named it Schubfachprinzip (drawer principle), and it is with Dirichlet that the principle came to be most commonly associated. Many authors date Dirichlet's use back to 1834, but without any reference. The French name was le principe des tiroirs de Dirichlet, the principle of Dirichlet's drawers. Cabillón traced the first appearance of pigeons in it to Robinson's On the Simultaneous Approximation of Two Real Numbers (1941).
However, neither Dirichlet nor Lagrange were the first, see The pigeonhole principle, two centuries before Dirichlet by Rittaud and Heeffer:
"In Selectae Propositiones, a book written in latin in 1622 by the French Jesuit Jean Leurechon, the pigeonhole principle is indirectly mentioned in a single short sentence, given without any further elaboration (, p. 2): "It is necessary that two men have the same number of hairs, gold, and others." The famous Marin Mersenne copied several propositions on arithmetic and music from Leurechon, including this mathematical principle in an early work of 1625, acknowledging the "excellent conclusions obtained from arithmetics" by the mathematicians from Pont-a-Mousson.
[...] Jean Leurechon was a factor of stability at Pont-a-Mousson, teaching mathematics on and off between 1614 and 1629. His short Selectae Propositiones from 1622 was a collection of propositions in mixed mathematics that were used for teaching. The booklet is one of the earliest witness accounts of the new mathematics curriculum at Jesuit colleges. Teaching was organised in lectures (lectiones), rehearsals (repetitiones) and discussions (disputationes).
[...] It is now established that an immensely popular work published at Pont- a-Mousson in 1624 resulted from these disputationes . Entitled Recreation mathematicque , this French work is commonly attributed to Jean Leurechon, but there are good reasons to believe that this attribution is wrong (see ). More than seventy editions and translations were published during the seventeenth century. (The First English translation appeared in 1633 .) The pigeonhole principle appears at the end of the book (just after some elementary remarks inspired by Archimedes' Sand Reckoner about the number of grains of sand that could fill the universe). Unfortunately, this remarkable part of the book does not appear in the English edition.
It is quite astonishing that the example of men with the same number of hairs is still a very common illustration of the principle (see for example  p. 3 where the case of New York City is considered, or  with the inhabitants of Madrid, etc.)... Indeed, the problem of men with the same number of hairs appeared in 1737, in a totally different context, in a French book by Charles-Irenee Castel de Saint-Pierre, which is in no way related to mathematics...
In the middle of the nineteenth century, the famous French writer Charles- Augustin Sainte-Beuve quoted extensively this passage [from de Saint-Pierre] in several publications (, , ), at the very same time Dirichlet made use of the principle in a purely mathematical context... So, do we have to replace the old Dirichlet's pigeonhole principle" by a Leurechon's pigeonhole principle"? We do not know for sure if Leurechon was really the first to publish the result. David Singmaster's comprehensive Sources in Recreational Mathematics  and our survey of Italian abbaco manuscripts revealed no earlier instances."