Both are infamous sleep disruptors, but they act in opposite ways, says Allison T. Siebern, PhD, CBSM, clinical assistant professor and the associate director of the Insomnia and Behavioral Sleep Medicine Program at Stanford University School of Medicine. Caffeine tricks your body into thinking that you aren't sleepy, Siebern explains. As soon as the effect wears off, you'll crash—which in this case isn't such a bad thing. However, if one glass of wine leads to two or three, you may initially find yourself drowsy, but once the alcohol starts to leave your system, Siebern says, you could start snoring, slip into nightmares, drench the blankets in sweat, feel your head pounding or experience dry mouth. So the post-meal espresso is likely to decrease the quantity of your sleep, while the wine will insidiously tamper with the quality of it. Caffeine may also take 4 to 7 hours—that's basically all night—to leave your system if you drink a potent cup or are particularly sensitive to it. Alcohol has a shorter half-life, Siebern says, which means it will leave the body in about 3 to 4 hours. If you can wait that long before going to bed, then cheers to you.
Best advice: Choose the coffee if you could use a few hours of alert time to get things done at home; the wine if you could use some more time to catch up with your friends. Skip both if you need to be up early tomorrow.