Sayyiduna Wa'il bin Hujr (may Allah be pleased with him) said: In the darkness of early morning a woman was coming towards the mosque when a man fell upon her (and assaulted her) and fled. She called for help to a man at the other side, and he ran after him. Meanwhile a group of people came, and the woman called on them for help; they seized the man who had come to help her and brought him to the Prophet (peace and blessings be upon him). That man said: He has run away; I only came to help. But those people and the woman began testifying against him that he was the one, so he (peace and blessings be upon him) ordered that he be stoned. The adulterer was also among the people, and he said: Let him go; I am the one who did this. Then the three of them were brought to the Prophet (peace and blessings be upon him), and he (peace and blessings be upon him) said to the woman: "Allah has forgiven you," and he spoke good words to the one who had helped. Concerning the adulterer, Sayyiduna Umar (may Allah be pleased with him) said: Stone him. The Prophet (peace and blessings be upon him) said: "No! He has repented with such a repentance that if the people of Madinah, or the people of Yathrib, were to repent like it, they would all be forgiven."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السرقة / 17323