It’s about time. We are now on Instagram!
1879, originally from cricket, "taking three wickets on three consecutive deliveries;" extended to other sports (especially ice hockey) c.1909. Allegedly because it entitled the bowler to receive a hat from his club commemorating the feat (or entitled him to pass the hat for a cash collection), but also influenced by the image of a conjurer pulling things from his hat (attested by 1876). The term was used earlier for a different sort of magic trick:
Place a glass of liquor on the table, put a hat over it, and say, "I will engage to drink every drop of that liquor, and yet I'll not touch the hat." You then get under the table; and after giving three knocks, you make a noise with your mouth, as if you were swallowing the liquor. Then, getting from under the table, say "Now, gentlemen, be pleased to look." Some one, eager to see if you have drunk the liquor, will raise the hat; when you instantly take the glass and swallow the contents, saying, "Gentlemen I have fulfilled my promise: you are all witnesses that I did not touch the hat." ["Wit and Wisdom," London, 1860]
In some sports, such as ice hockey, three goals by one player in a single game: “Lemieux scores for the third time tonight; he finally has the hat trick he's been looking for all season.”
Note: By extension, a hat trick is an outstanding performance by an individual, or a particularly clever or adroit maneuver: “She pulled off a hat trick with her presentation to the committee.”
Note: The phrase originally referred to a hat traditionally given to a cricket player who scored three wickets, or goals.
[fr cricket, ''the bowling down of three wickets with successive balls,'' probably compared with the magician's trick of pulling a rabbit out of a hat; also said to be a feat that entitled the player to the proceeds of a collection, that is, a passing of the hat, ortoa new hat]