Or...according to Scottish legend, if you were bitten by a dog, the best cure for the wound was to place some of the guilty animal's hair on it. (There could actually be valid medical reasons for such a procedure...after all, putting spider-webs on wounds apparently hastens healing.) This idea of curing like with like is how the phrase came to be associated with taking alcohol to get rid of the effects of drinking the same stuff!