In the Mahabharata, Parikshit was cursed by the son of a sage to die within seven days due to his disrespectful act of placing a dead snake around the sage's neck. This curse led him to seek spiritual knowledge from Shukdevji through the Bhagavata Purana before his death.