Kid Rock proposed to sex bomb Pam Anderson just days after he was ready to dump her!

The foulmouthed rap-rocker walked out on the “V.I.P.” vixen after learning that she had potentially fatal hepatitic C and didn’t tell him. Pals say. But Kid h ad a sudden change of heart — and proposed on bended knee with a dazzling diamond ring!

“Just days before, Kid was raging at Pam for sleeping with him without revealing her medical condition,” said a source close to the 31-year-old bad-boy, whose real name is Robert Ritchie.

“He had her sobbing with guilt, admitting she was too scared to let him know the truth.

“But a week after walking out in disgust, Kid was back — telling Pam he still loved her.”

Friends say that after railing at Pam, Kid decided he couldn’t abandon Pam during her time of need — and proposed in the desert outside Las Vegas on April 11.

After he and Pam drove to a prearranged location, Kid’s buddy Uncle Kracker pulled up in a pink Cadillac, wearing an Elvis jumpsuit.

“Pam said that she burst out laughing at Uncle Kracker,” said a pal.

But her laughter turned to tears when Kid got down on one knee and proposed.

Kid, whose never been married, is raising his 8-year-old son with the help of his sister in Michigan.

Pam, 34, is embroiled in a nasty child custody battle with her ex-husband Tommy Lee over their sons Brandon, 5, and Dylan, 4.

The tattooed lovebirds have yet to set a date.

“But Pam is already planning a big wedding,” said the source, “and she’s told her boys they’re getting another dad.”