Two demons born from Vishnu's ear-wax threaten Brahma and steal the Vedas; who saves the day depends on the sect — Vishnu as Hayagriva in the epic line, or the Goddess who must first leave Vishnu's body in the Devi Mahatmya.
The Devi Mahatmya opens with this story to show the Goddess's power. Vishnu lies in the sleep that is the Goddess herself, Yoganidra, while Brahma sits on the navel lotus; the two demons rise from Vishnu's ear-wax and advance on Brahma. Unable to rouse Vishnu, Brahma sings to the Goddess as the one who creates, sustains and dissolves, and asks her to leave Vishnu's body. She does; Vishnu wakes and fights the pair for five thousand years. Bewildered by her delusion they offer him a boon; he asks for their death, and they consent to die only where no water floods the earth. He sets them on his lap and cuts their heads off with the discus — a play, commentators note, on the words for thigh and earth. Brahma's hymn is the text's first and is also called the Ratri Sukta.
What is different here:
Base telling. Neither Brahma's plea nor Vishnu's strength works until the Goddess consents; the Vedas are not the object.
Mahabharata Shanti Parva and the Bhagavata line — Hayagriva
Pan-IndiaVaishnava
In the epic and Vaishnava line the demons' crime is theft: they carry off the Vedas from Brahma and hide them in the primeval waters. Vishnu takes the horse-headed form Hayagriva, kills the two, and brings the Vedas back to Brahma, ending his grief. Their bodies, in some tellings, break into twelve pieces that become the continents; Vishnu bears the names Madhusudana and Kaitabhajit from the deed, and a later demon Dhundhu tries to avenge them.
What is different here:
Vishnu acts alone and awake; the Goddess does not appear; the Vedas are the object.
The Devi Bhagavata explains why the demons were so hard to kill: born of Vishnu's ear-wax, they had worshipped Mahadevi and won from her the boon that they would die only by their own consent. They attack Brahma, steal the Vedas and hide in the netherworld. Vishnu flatters them into offering him a boon, asks for their deaths, spreads his thighs over the water as solid ground and beheads them with the Sudarshana. Book 1 was not read in translation and is cited through Wikipedia.
What is different here:
Adds the Devi's boon as the source of their invulnerability and the Vedas theft; the thigh becomes dry land.