I went to the Oxford English Dictionary to learn the history of the term
"hat trick".  Definition 1 is irrelevant to us.
2. Cricket. The feat of a bowler who takes three wickets by three successive
balls: considered to entitle him to be presented by his club with a new hat or
some equivalent.
1882 Daily Tel. 19 May  He thus accomplished the feat known as the 'hat trick'
and was warmly applauded.
 
From the OED supplement:
1887 J. Lilleywhite Cricketer's companion 181  Having on one occasion taken six
wickets in seven balls, thus performing the hat-trick successfully.
(oops, that was supposed to be 1877--lms)
b. Hence gen., a three fold feat in other sports or activities.
1909 Daily Chron. 12 Aug 9/2 ( a quote from horse racing.  No hockey references
provided, but remember the OED is primarily Brit. English)
Linguistically yours,
Lisa