The expression the hair of the dog, for an alcoholic drink taken to cure a hangover, is a shortening of ‘a hair of the dog that bit you’.
It comes from an old belief that someone bitten by a rabid dog could be cured of rabies by taking a potion containing some of the dog’s hair.
Not sure I would be prepared to try this though!!