Chapter 21 of 42 · Shata Rudra Samhita · Overall chapter 250 of 464
Mahesha Avatara
A brief, unusual pastime: Parvati, playfully disguised as a madwoman, is mistaken by her own doorkeeper Bhairava for a desirable stranger and detained by him - earning him a curse of human rebirth from an angry Parvati, which Shiva softens by taking a matching human birth of his own alongside him as Mahesha and Sharada.
Nandishvara said
Sage, son of the self-created, hear lovingly another of the great lord Shankara's avataras. One who listens gets everything he wishes. Once Girija and Shankara wished to enjoy themselves, and Parameshvari by her own will made Bhairava a doorkeeper and then they went inside. Following human ways, they were lovingly served by many friends, and those two self-ruling ones, Parameshvara and Parameshvari, enjoyed themselves for a long time in many kinds of play. In her own play self-ruling Devi Shivaa took the form of a mad woman and, with the lord's leave, came in that form to the door. Bhairava looked at Devi as he would at a beautiful woman, deluded by that form, and stopped her from going out. Devi Shivaa grew angry and Ambika cursed him: worst of men, you looked at me as at a woman, so be born as a human being on earth. Bhairava, cursed so by Shivaa, lamented greatly, reduced to grief by that play. Shankara quickly arrived, skilled in many kinds of consolation, and comforted Bhairava. By that curse Bhairava took an avatara on earth, and by Shankara's wish was born in a human womb, known as Vaitala. Out of affection for him Lord Shiva also took an avatara on earth, with Shivaa, and they took part in many kinds of worldly play. Shiva was known as Mahesha and Girija as Sharada, and, skilled in many kinds of play, they lovingly enjoyed their sports. Nandi told Sanatkumara he had thus told Mahesha's excellent account, which gives wealth, fame, long life and all wished-for fruits. A person who controls himself and devotedly listens, or has it heard, enjoys all pleasures in this world and finally gains liberation.
Retold in our own words from Bibek Debroy's English translation of the Shiva Purana (Penguin Classics). Names, numbers and the order of events follow the source.