The Crown Office initially decided there was insufficient evidence against John Carignani, 41.
The child's mother then contacted Carignani and kept a letter, text messages and recordings of phone calls in which he admitted his guilt.
At the High Court in Edinburgh, he was jailed for four-and-a-half years.
Judge Lord Boyd of Duncansby told Carignani, formerly of Cuthelton Street in the Tollcross area of Glasgow, he would have faced a six-year sentence for his crimes had it not been for his guilty pleas.
The judge had been told the mother contacted Carignani after the Crown Office decision not to prosecute last year.
After first denying the allegations that he had raped her child, he texted: "I can only say I'm sorry for everything."
He then sent a further text stating: "I'll be dead by the morning. I'm sorry."
Carignani also sent her a letter saying: "I lost control of myself and I tried to hide that. Please don't think of me as some kind of a monster, because I am not. Not really."
He then contacted the woman by phone and she recorded their conversations.
During one call, he said that he was not in control of himself.
The court heard that the content of the letter, text messages and what was said by Carignani in his phone calls provided the necessary supporting evidence after the girl revealed the abuse she had suffered to her mother.
Lord Boyd told him: "I take into account your expressions of remorse which I accept are genuine."
Unemployed Carignani earlier admitted the rape and sexual assault on the girl at two houses in Glasgow in December 2014 and April the following year.
Defence solicitor advocate Ann Ogg said Carignani had committed the offences when he was intoxicated, but added: "He recognises that that is no excuse."
Her client was placed on the sex offenders' register.
A man has been jailed for raping a 10-year-old girl after the victim's mother helped gather evidence against him.