In the Markandeya Purana, when Yama came to take young Markandeya's life, the boy embraced Shiva's lingam. Shiva appeared, kicked Yama, and defeated death to protect his devotee, granting Markandeya immortality. Vishnu, Ganesha, and Durga are not associated with this legend.