The following is an taken from ‘On the Sayings of the Gnostics at Funerals & Cemeteries, & the Legal Verdict Concerning the Visitation of Graves’ from The Remembrance of Death and the Afterlife of Imam al-Ghazali (r.a.).
It is related that a certain man deeply sunk in depravity once passed away in a district in Basra. His wife was unable to find anyone to help her carry him, since not one of her neighbours paid him any heed on account of his great wickedness. So she hired some carriers, who bore him out to the prayer-place, where there was no one to pray for him. Now, on a mountain close by there was one of the great ascetics, and he came and prayed for the deceased.
The news that the ascetic had done this spread throughout the city, and the people were greatly astounded that he should have thus prayed for him, but he told them, “I was Instructed in a dream to descend to such-and-such a place, where I would see a man’s funeral attended only by a woman, and there to offer prayers for him, for he had been Forgiven his sins.”
The people’s astonishment increased at this, until the ascetic summoned the woman and questioned her about the circumstances and behaviour of the dead man.
“As people know,” she said, “his entire day was spent in the tavern where he occupied himself with drinking wine.”
“See now,” the ascetic said, “do you know any good deeds which were to his credit?”
“Yes,” she replied, “three things. Every day at dawn he used to awaken from his drunkenness, change his clothes, perform the ablution, and offer the dawn prayer (Fajr prayer) with the congregation. Then he would return to the tavern and occupy himself with vice. The second thing is that his house was never devoid of one or two orphans, to whom he showed even more kindness than he did to his own children, and for whom he was greatly solicitous. The third thing is that in the darkness of the night and in the very midst of his drunkenness, he would awaken, weep, and say, ‘O Lord! Which corner of Hell do You Wish to fill with this foul man?’ – by which he meant himself.”
And so the ascetic went his way, the obscurity surrounding the affair having been cleared.