This firefighter needed lifesaving open-heart surgery when he got a potentially fatal blood infection — for a really corny reason.

Adam Martin, 41, was “on death’s door” after endocarditis left him fighting for his life. This infection of the inner lining of the heart chambers and valves occurs when germs from another part of the body spread through the bloodstream and damage the heart.

Doctors quizzed the father of three from Cornwall in the UK about a possible cause — and he could only think of one culprit: Martin’s life-threatening ordeal was traced back to late September, when he shared a bag of popcorn with his wife, Helen, 38, while watching a movie.

The infection was caused by his constant poking and prodding at a piece of popcorn lodged between his teeth. Martin told his medical team he used “items I found laying around” — a pen cap, a toothpick, a piece of wire and even a nail — in a desperate attempt to dislodge the stubborn hull.

One tool he didn’t use: a dentist.

A week later, Martin was suffering night sweats, fatigue, headaches — and eventually a heart murmur, which are all signs of the infection, according to the Centers for Disease Control and Prevention.

“The doctors told me if I hadn’t gone to the GP when I did, then I could have been dead in three days,” Martin said. “Most people die when they are at 350 on an infection scale and I was at 340. The infection had eaten my heart valves completely.”

The dad and firefighter told South West News Service, “I am never eating popcorn again, that’s for sure,” but he admits, “If I had gone to the dentist in the first place, then none of this would have happened.”

The popcorn, stuck between molars on the left side of his mouth, plagued him for three days — but no matter how hard he tried, he couldn’t dig it out.

A week later, Martin developed what he thought was a cold, which then grew into what was assumed to be the flu — and on Oct. 7, he went to his family doctor, who diagnosed a mild heart murmur and sent him for blood tests and X-rays. Both came back showing nothing more than slightly raised inflammation markers.

Martin was sent home with medication, but a few days later, he was still experiencing “flu-like symptoms.” He also developed a blood blister on his toe — which was later diagnosed as a Janeway lesion, an external indication of infective endocarditis, the CDC reports.

Endocarditis can lead to bacteria spreading through the bloodstream and damaging areas in the heart. If treatment is delayed, endocarditis can damage or destroy heart valves.

Alternately sleeping too much and dealing with intense leg pain, Martin finally went to the Royal Cornwall Hospital on Oct. 18.

“I had a feeling there was something seriously wrong,” he told South West News Service. “I was admitted to hospital the same day for tests. By this point I was very worried. I felt quite ill and I knew I was not right at all.”

The muscle ache in his leg turned out to be an infected clot blocking his femoral artery, which required a five-hour operation to clear. The patient was treated with medications to fight infection, but chest scans revealed his heart had been severely damaged — and would need emergency surgery.

Martin was transferred to Derriford Hospital in Plymouth on Oct. 21 for a seven-hour open-heart surgery to replace his aortic valve and repair his mitral valve.

“My heart was not properly working anymore; it was essentially wrecked. The infection had eaten the valves away,” he said. “I won’t be going near popcorn again, that’s for sure. It’s crazy to think all this happened because of that. It was something so trivial.”

Martin made a quick recovery following surgery and returned home to Helen and their three kids — George, 7, Holly, 14, and Megan, 15 — at the end of October.

Helen, a teaching assistant, encourages the public to heed early warning signs such as toothache and bleeding gums — not to mention the oft-referenced “flu-like symptoms.”

“Get it checked out!” the relieved matriarch moaned. “If Adam’s infection was caught earlier, it could have been treated with antibiotics. Your gums are a bacterial highway to your heart.”