It is narrated from Sayyiduna Abu Hurayrah and Sayyiduna Zayd bin Khalid al-Juhani (may Allah be pleased with them both), and in Sufyan's narration also from Shibl, that two men brought their dispute to the Messenger of Allah (peace and blessings be upon him). One of them said: O Messenger of Allah! Judge between us according to the Book of Allah. The other, who had more understanding, said: Yes, O Messenger of Allah! Judge between us according to the Book of Allah, and permit me to speak. He said: "Speak." He said: My son was a hired worker for this man ('asif means a hired worker), and he committed adultery with his wife. I was told that stoning was due upon my son, so I ransomed him from it with a hundred sheep and a slave girl of mine. Then I asked the people of knowledge, and they told me that upon my son are only a hundred lashes and exile for a year, while stoning is due upon his wife. The Messenger of Allah (peace and blessings be upon him) said: "By the One in whose hand is my soul! I shall judge between you two only according to the Book of Allah: your slave girl and your sheep are returned to you." And he had his son given a hundred lashes and exiled him for a year, and he ordered Unays al-Aslami to go to the other man's wife and, if she confessed, to stone her. She confessed, so she was stoned.
Hadith Referenceالمعجم الكبير للطبراني / باب الزاي / 5172