A group of lifelong friends gathered at a unit in Cronulla for a baby shower.
Late in the evening, some of the women's partners joined them and the group spent the night celebrating.
About 1am, a woman burst out of a bedroom screaming she had woken up to find her friend's "slime ball" boyfriend raping her.
The man, who cannot be identified, told police he drunkenly went to the wrong bedroom, and thought he was in bed with his girlfriend. He denied any sexual activity.
A jury found him guilty of one count of sexual intercourse without consent in 2015, and he was sentenced to a minimum of three years' jail, with a maximum of five years and nine months.
The man appealed against his conviction and sentence in the NSW Court of Criminal Appeal, arguing he had an "honest and reasonable but mistaken belief" the victim was his girlfriend.
The court last week dismissed the man's appeal, in a decision that emphasised accused rapists cannot use intoxication in their defence.
The decision also addressed the issue of "recklessness" in considering consent.
The victim told the trial she woke up in the early hours of May 19, 2013, to find her friend's boyfriend on his haunches between her legs.
"It was like he was just focused on himself," she said.
She ran to the man's girlfriend's room in distress, then saw him in the hallway.
"He just stared me down and he said, "She won't believe you.' "
On appeal, the man argued he had a mistaken belief that the woman he penetrated was his girlfriend, pointing to a Queensland court decision that found "inebriation … may help to induce a belief that a woman is consenting to intercourse".
But the Court of Criminal Appeal cited NSW law that self-induced intoxication cannot be taken into account when considering an accused rapist's intent.
The law states sexual assault is not a crime of "specific intent" and an accused person must be viewed as if sober.
Justice Peter Johnson also noted the victim was asleep, and consent could never be assumed, even if the man believed the woman was his girlfriend.
"It is open to a spouse or partner to refuse to consent to sexual activity. Consent cannot be taken for granted," Justice Johnson said.
The man also argued the jury's verdict was unsound because the case relied on the evidence of the victim, who was intoxicated.
The appeal panel, also comprising Justice Stephen Rothman and Justice Julia Lonergan, rejected the argument, finding it was open to the jury to believe her.
Justice Rothman also stressed the importance of ensuring consent.
"Even if [the man] believed the woman in the bed was his partner, he took no steps to ascertain her consent and was reckless as to the existence of consent.
"It is no longer (if it ever were) the situation that a sexual partner or spouse is presumed to consent to sexual conduct."