A man jailed for rape four years ago has had his conviction overturned after new Facebook evidence emerged.
Danny Kay's sentence was quashed by the Court of Appeal after deleted messages were found in an archived folder backing his version of events.
The 26-year-old had denied rape at Derby Crown Court in 2013 but was jailed for four-and-a-half years.
Judges ruled on Thursday the new evidence supported his claim the sex was consensual.
The messages showed that jurors at the trial had been given an "edited and misleading" picture of the conversation between the pair, the court heard.
In his ruling, Mr Justice James Goss said: "We have come to the conclusion that, in a case of one word against another, the full Facebook message exchange provides very cogent evidence both in relation to the truthfulness and reliability of (the woman) ... and the reliability of (Mr Kay's) account and his truthfulness."
Judges heard police asked the woman to retrieve Facebook messages that they had exchanged.
Three pages of messages had been printed and the woman, who cannot be identified, told jurors she had deleted some to free up storage space.
She had said there had been little contact after sex, but defence lawyers argued the new evidence showed otherwise.
The ruling comes after a Conservative MP's chief of staff was cleared of rape after saying sex was consensual.
In another high-profile case, charges against 22-year-old student Liam Allan were dropped after police failed to reveal vital phone evidence.