Turns out that fruit flies, like humans, tend to their romantic wounds by drinking.

When male fruit flies experience periods of sexual rejection, they are more likely to consume food supplemented with 15 percent alcohol than their sexually satisfied peers, a University of California San Francisco research team found.

When male flies mated with females, they were less likely to binge than their continually thwarted cohorts, the UCSF researchers said in a paper published online Thursday in the journal Science.

Scientists found one sure-fire way to get frustrated flies to kick the habit: sex.

The effects of sexual deprivation can be reversed by copulation, the UCSF researchers said -- perhaps unnecessarily.

The researchers found that another way to reign in a spurned fly's urge to imbibe was to manipulate levels of a molecule called neuropeptide F, or NPF, which is linked to reward-seeking behavior.

Normally, flies that mate with females have high levels of NPF in their brains, while frustrated flies have less. When the researchers artificially activated the NPF-signaling pathway in virgin male flies, the manipulated insects were less apt to prefer alcohol-laced food after sexual rejection.

UCSF anatomy and neurology professor Ulrike Heberlein, who led the research team, said in a statement that the NPF findings could lead to a better understanding of how humans are driven to drink.

Human brains have a similar neurotransmitter called neuropeptide Y, which suggests that it might be possible to create addiction treatments by blocking NPY receptors, Heberlein said.

Flies aren't always chasing the bottle to chase away the blues, though.

An Emory University team found that fruit fly larvae seek out food with higher alcohol content if they have been infected with wasp larvae.

By eating rotting fruit or other foods with higher levels of alcohol, fly larvae could also ward off wasps from laying eggs in them, the Emory scientists said in a study published online by the journal Current Biology in February.

The alcohol did not kill the adult wasps, but may have sickened them or alerted them to a hostile environment for their young, the researchers said.