In the Shanti Parva of the Mahabharata, Bhishma, whilst resting on the bed of arrows and discoursing on Dharma, refers to the observance of Maha Shivaratri by King Chitrabhanu. The story goes as follows - Once upon a time King Chitrabhanu of the Ikshvaku dynasty, who ruled over the whole of Jambudvipa, was observing a fast with his wife, it being the day of Maha Shivaratri. The sage Ashtavakra came on a visit to the court of the king.
The sag asked the king the purpose of his observing the past. King Chitrabhanu explained that he had the gift of remembering the incidents of his previous birth.
The king said to the sage that in his previous he was a hunter in Varanasi and his name was Suswara. His only livelihood was to kill and sell birds and animals. One day while roaming through forests in search of animals he was overtaken by the darkness of night. Unable to return home, he climbed a tree for shelter. It happened to be a Bael tree. He had shot a deer that day but had no time to take it home. So he bundled it up and tied it to a branch on the tree. As hunger and thirst tormented him, he was kept awake throughout the night. He shed profuse tears when he thought of his poor wife and children who were starving and anxiously waiting for his return. To pass away the time that night he engaged himself in plucking the Bael leaves and dropping them down onto the ground.
The next day he returned home and sold the deer and then bought some food for himself and his family. The moment he was about to break his fast a stranger came to him, begging for food. He served the food first to stranger and then had his own.
At the time of his death, he saw two messengers of Lord Shiva. They were sent down to conduct his soul to the abode of Lord Shiva. He learnt then for the first time of the great merit he had earned by the unconscious worship of Lord Shiva during the night of Shivaratri. The messengers told him that there was a Lingam at the bottom of the tree. The leaves I dropped fell on the Lingam. His tears, which had shed out of pure sorrow for his family, fell onto the Lingam and washed it and he had fasted all day and all night. Thus, he unconsciously worshiped the Lord.
As the conclusion of the tale the King said that he lived in the abode of the Lord and enjoyed divine bliss for long ages and now he has reborn as Chitrabhanu.