Jami` at-Tirmidhi, Book 47, Hadith 3329 (In-Book) ⓘ
Narrated Ibn 'Abbas: "They (the Companions) said: 'O Messenger of Allah, how do you hold those who died while they were drinking Khamr - considering that the prohibition of intoxicants is now revealed?' So, (the following) Ayah was revealed: "Those who believe and do righteous good deeds, there is no sin on them for what they ate (in the past), if they fear Allah and believe and do righteous good deeds."
حَدَّثَنَا عَبْدُ بْنُ حُمَيْدٍ، حَدَّثَنَا عَبْدُ الْعَزِيزِ بْنُ أَبِي رِزْمَةَ، عَنْ إِسْرَائِيلَ، عَنْ سِمَاكٍ، عَنْ عِكْرِمَةَ، عَنِ ابْنِ عَبَّاسٍ، قَالَ قَالُوا يَا رَسُولَ اللَّهِ أَرَأَيْتَ الَّذِينَ مَاتُوا وَهُمْ يَشْرَبُونَ الْخَمْرَ لَمَّا نَزَلَ تَحْرِيمُ الْخَمْرِ فَنَزَلَتْْ : ( لَيْسَ عَلَى الَّذِينَ آمَنُوا وَعَمِلُوا الصَّالِحَاتِ جُنَاحٌ فِيمَا طَعِمُوا إِذَا مَا اتَّقَوْا وَآمَنُوا وَعَمِلُوا الصَّالِحَاتِ ) . قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ حَسَنٌ صَحِيحٌ .
also referenced under: Hadith 3052 (Reference) & Volume 5, Book 44, Hadith 3052 (DarusSalam)