It's the hair of the dog that bit you.They used to believe that you could be cured of rabies by eating a hair of the rabid dog which had bitten you.Nowadays it's used in the context of having another drink the next day after overdoing it the night before in the hope it will cure your hangover.
I hasten to add it has never worked for me!
it is hair of the dog but i think it was to actually rub the hair of the dog that bit you into the wound it caused to stop rabies rather than eat the hair.