On a flight from Geneva to New Delhi, a 30-year-old Dutchman with Type-1 diabetes had a hyperglycemic episode in which he fell unconscious and began foaming at the mouth.

The doctor onboard had an insulin pen which used a specific cartridge containing a long-term slow-working insulin, totally different from the one required by the Dutchman.

Luckily, a 21-year old student at IIT-Kanpur in India fixed the pen using a makeshift spring from a ballpoint pen.

The updated insulin pen was able to save the Dutchman's life.

If you suddenly fall ill on a long-haul flight, you're probably hoping there is a doctor onboard. However, perhaps you should keep your eyes peeled for engineers instead.

Karttikeya Mangalam, a 21-year old student at IIT-Kanpur in India, was flying from Geneva to New Delhi in February after finishing his exchange year in Switzerland. A few hours into the fight, a member of the aircrew announced that dreaded question to the passengers: "Is there a doctor onboard?!"

As Karttikeya explains in a blog post, it turned out a 30-year-old Dutchman named Thomas had Type-1 diabetes and was on the verge of a hyperglycemic episode, where the body’s blood sugar levels are way higher than normal. Sweating, nauseous, and faint, Thomas told the flight attendant he had not administered any insulin for over five hours as his insulin pump had been lost at the airport's security check.

Luckily, there was a Russian doctor onboard who quickly worked out the problem, despite their language differences. Even more fortunately, the doctor was also diabetic and equipped with insulin and a specialized contraption to inject insulin.

However, Thomas's luck quickly ground to a halt. The doctor's insulin pen used a specific cartridge containing a long-term slow-working insulin, totally different from the one required by Thomas. With his glucose levels spiking, he fell unconscious and began foaming at the mouth.

After hearing the plane was heading for an emergency landing, Karttikeya talked to the doctor about attempting to fix the pen and cartridge dilemma. The doctor said there was a way to change the cartridge holding tube diameter, but when he finished making the adjustment, the needle wouldn’t move.

With the plane starting to descend but not able to land for another hour and a half, and the doctor concerned he didn't have that long, Karttikeya used the plane’s WiFi to download a PDF of the pen’s design schematic. It became apparent that a small spring just behind the cartridge was missing from the device.

"Keeping a cool head, I instructed the air hostess to ask the passengers for any ballpoint pens, which usually have a spring in them. In a few minutes, I got 4-5 pens from the anxious passengers," writes Karttikeya.

Remarkably, one passenger had a spring that was a perfect fit. They assembled the pen back together with the makeshift spring and the doctor injected Thomas with his own insulin cartridge. Within 15 minutes, his blood sugar levels stopped rising and then slowly ticked back down to normal, before he returned to consciousness. The day was saved.

"He thanked me a lot and told me to come visit him in Amsterdam where he owns his own restaurant and brewery and where I supposedly would receive as much free food and beer as I want," Karttikeya said.

"I think saving a man’s life is more than what anyone could ever imagine achieving from the basic engineering knowledge endowed in [freshman] year."

Sign up here to get INSIDER's favorite stories straight to your inbox.