The Bloody Mary cocktail was once referred to as the Hair of the Dog and drunk as a hangover cure. Why it is now called the Bloody Mary is unclear, but the phrase Hair of the Dog is an expression meaning to cure yourself with the very thing that you are afflicted with. It references the old practice of rubbing the hair from a rabid animal in the bite wound as a (very unsuccessful) way to cure rabies.
The practice of drinking alcohol as a cure for a hangover is as old as alcohol itself.In Polish they say “[to dislodge] a wedge [with] a wedge” – [wybijać] klin klinem. In Germany they have a ‘counter-beer’ (ein Konterbier trinken). In Austria they have a repair beer (Reparatur-Seidl).
In Danish they have the expression “one must rise at the tree where they fell” in reference to this style of hangover cure. In Romania, Turkey, Bulgaria and Italy they say ‘a nail dislodges a nail’.
The real question though is, can you cure a hangover with alcohol? Well, not exactly say the experts. You may feel better at the moment, but you are probably just postponing the inevitable symptoms.