Having a morning drink after a night of too much drinking is one cure for a hangover. Although it's unlikely that "hair of the dog" works, the idea of treating yourself with what caused the problem in the first place is a homeopathic idea.
One of the primary tenets of homeopathy is that like cures like. The right treatment for an illness is the treatment that produces the same symptoms in a healthy person. So if you have a headache, whatever herb or drug causes a similar headache in a normal person is the right treatment. This idea forms the foundation of homeopathy.
Homeopathy was an extremely popular medical movement in the 19th century, rivaling orthodox medicine for supremacy. A big part of its appeal was its simplicity--you could buy a homeopathy kit that would help you match symptoms to treatment--and the minimal pain inflicted by its therapies.
At the time, many doctors and patients believed that a drug needed to cause a lot of pain to be effective. How else were you to know that it was working if you weren't bleeding or passing out? Homeopathists proposed an alternative: that drugs don't have to hurt to work. Homeopathists treated patients with very small doses of medicine diluted at least 30 (and often many more) times. While many critics derided the use of small doses, claiming that they could never treat anyone, homeopathists at least knew that they were causing no more harm. The same could certainly not be said of regular doctors and their regimen of bleeding, puking, blistering, and sweating.
Homeopathy also claimed some successes in treating people during cholera epidemics in 1832 and 1849, leading many regular doctors to defect to homeopathy. Cholera sufferers got small doses of camphor and were urged to seek out clean air and water. While homeopathy may have done little to cure these people, they also didn't cause more pain to people already suffering as bleeding, blistering, and sweating likely did.
Homeopathy fell out of mainstream favor in the 20th century, but some of its ideas live on in things like "hair of the dog." Homeopathists didn't invent or even endorse the idea of treating a hangover with alcohol, but the idea of like curing like is imbedded in that urban myth. Homeopathy also changed our view of what medicine is supposed to feel like. Today, we look for drugs with few side effects, not the painful, visible signs of treatment from the past.