The "essence of earth and heaven" is holy water (Ganga) given by Shiva .
Chapter 26, Koti Rudra Samhita of Shiva Mahapurana says
ततस्तु शङ्करो देवः पृथिव्याश्च दिवश्च सः।
सारं चैव समुदधृत्य
रक्षितं पूर्वमेव तत्॥ २१॥
विवाहे ब्रह्मणा दत्तमवशिर्छ च किञ्चन।
तत्तस्मै दत्तवाञ्शम्भुर्मुनये भक्तवत्सलः॥ २२॥
Then Siva, took out the essence of the heaven and earth, which had
been extracted earlier, and was given by Brahma to Siva in the
marriage of the latter, besides the remaining water of the Ganga, was
given away to Gautama by lord Siva, who is well disposed towards his
devotees.
Above story is described in detail in Gautami Mahatmya of Brahma Purana.
We know, Lord Brahma spilled His semen on seeing Devi Parvati during Shiva Parvati's marriage. To liberate Brahma from that sin, Lord Shiva produced essence of Earth and water and gave it to Brahma in a jar vessel. On touching that Ganga, Brahma was liberated from that sin.
Chapter 3 Gautami Mahatyam of Brahma Purana says
Siva said :
- Call Brahmä here. I shall make him free from sin. Even if other people commit offences good people take pity on them. They have
sympathy for them in their minds, This is the nature of worldly
objects. They delude even great scholars.
Brahma said :
23-25. After saying this, Lord Siva accompanied by Umä began
operations. The lord of the worlds did this due to his sympathy for me
and desire for the welfare of the worlds. Listen to it attentively, O
Närada.
'The Earth and Waters shall become the means ofredemption of sinners from their sins. I shall extract their ultimate essence that is holy,"
After declaring this the lord extracted their essence.
26-27. He made the Earth into a water-jar and poured water into
it. With great effort he chanted Pävamänya (Verses in 9th mandala of
Rigveda relating to Soma Pavamana) and other hymns and consecrated
them. The lord who dispels sins remembered Sakti who sanctifies the
universe and invoked her there. Then the lord of the worlds said to
me, "Take this water-jar,
Indeed the waters are goddesses and mothers, The Earth is another mother. So both of them are the causes of existence, creation and
destruction.
It is here that Dharma is established. It is here that the eternal sacrifice is established. It is here that enjoyment and salvation,
mobile and immobile beings are established.
By remembering it the mental sin perishes. By bowing to it the verbal sin perishes. By bathing, drinking and performing the holy
ablution, the physical sin perishes.
This alone is nectar in the world. There is nothing greater in sanctity than this. O Brahmä, take this water-jar consecrated by me
with holy Mantras.
Whoever remembers or drinks the water herein attains all desired things. Take this water-jar,
Of all the five elements, water is the element of great effect. This water is the best among all those waters. Take this water-jar,
O Brahmä, by touching, remembering and seeing the water herein, which is very splendid, holy and sacred, one is liberated from sin."
35-36. After saying this the supreme lord gave me the water-jar. Then
Devas joyously spoke to their lord. There was great exhilaration
there. Cries of victory rang the sky.
In fourth Chapter of Gautami Mahatmya, Lord Brahma says He offered Holy water from his water-jar to Holy feet of Vamana (Vishnu).
- "What is that work which shall be auspicious in this second step of Vishnu whereby my water-jar shall become excellent
59-63. The water bestowed by the enemy of Tripuras is highly
meritorious, It is excellent, It bestows boons. It is calm. It is
highly conducive to tranquillity, It is splendid. It bestows
splendour. It is eternal. It yields worldly enjoyment and salvation,
It is in the form of the mother of the worlds, It is nectar. It is
holy. It is sacred. It is It is pure panacea (for all ills). worthy of
worship. It is the greatest and the most excellent. It is conducive to
splendour, By remembering it sanctifies the worlds. What if it is seen
? Remaining pure, I shall utilize that water as the libation to my
father. Thinking that, I took that water and used it for argha
(offering ) The water for Argha, that was consecrated by the
recitation of Mantras fell on Vishnu's foot. That water fell on the
Meru and flowed to the Earth in four ways.
By means of his matted hair, Shankara caught hold of water that flowed towards south.
Portion of Ganga in matted hair of Lord Shankara was later given to Gautama as Gautami (Godavari).
This story of "origin of Ganga" might have happened in some Kalpas (such as Kalpas of Shiva Purana and Brahma Purana), as there is other story about "origin of Ganga" from holy Feet of Vamana (Lord Vishnu).