From New World Encyclopedia -
A mythological origin for the Kapalikas is given in the Goraksa-siddhanta-samgraha, which tells of an occassion upon which the 24 avatars of Vishnu became intoxicated with wine. Varaha and Narasimha, among other powerful avatars began destroying the earth, frightening its inhabitants; Krishna, meanwhile, was filled with adulterous emotions, while Parasurama destroyed a number of Kshatriyas. Shiva became angered by the actions of the gods and assumed the form of 24 Kapalikas in order to battle the avatars. Each Kapalika cut off the head of one avatar, stripped it of its flesh and carried the skull around with them from that point on
Is this story mentioned in any Purana, Vaishnav Samhita, Shaiva Agama or other scripture that is considered of divine origin by any sect?