In one of the most shocking tales of survival-at-sea ever told, a man lived for almost three days inside a sunken ship at the bottom of the ocean.

In May, a tugboat with a crew of 12 was moving through choppy waters off the coast of Nigeria. The boat was towing an oil tanker when a sudden ocean swell or rogue wave slammed into the vessel, snapping the tow rope and capsizing the vessel at about 4:30 a.m.

Harrison Okene, the ship's cook, was in the bathroom when the boat turned over and began to sink. Most of the other crew members were locked in their cabins — a safety precaution necessitated by the pirates who regularly rob and abduct vessels in that area. That safety measure, however, sealed the other crew members' doom. [Disasters at Sea: 6 Deadliest Shipwrecks]

In the predawn darkness, Okene was tossed from the bathroom wearing only his boxer shorts. "I was dazed, and everywhere was dark as I was thrown from one end of the small cubicle to another," he told The Nation. Okene was luckier than his crewmates, however. Locked inside their cabins asleep, none survived the ship's sinking.

Okene eventually scrambled into the engineers' office, where he found a small pocket of air. By this time, the boat had come to rest upside down on the seafloor at a depth of about 100 feet (30 meters). Almost naked, with no food or fresh water, in a cold, wet room with a dwindling supply of oxygen, Okene's odds of survival seemed to be near-zero.

Tales of survival

Through a series of odd coincidences and amazing good luck, Okene survived. Other people who have been trapped underwater have equally hard-to-believe tales of survival under near-impossible conditions.

In 1991, scuba diver Michael Proudfoot was exploring an underwater wreck off the Baja California coast when he accidentally smashed his breathing regulator, losing his entire air supply. Finding an air pocket, Proudfoot reportedly survived for two days on raw sea urchins and a small pot containing some fresh water before he was rescued.

In addition to his small pocket of air, Okene also discovered a bottle of Coca-Cola and a life vest with two small flashlights attached. But as Okene listened to the sounds of sharks or other fish devouring the bodies of his crewmates, he began to lose hope, he is reported as saying.

The physics of staying alive

The air pocket Okene found was, by his estimation, only about 4 feet (1.2 m) high, and humans inhale roughly 350 cubic feet (10 cubic meters) of air every 24 hours.

However, because Okene was under pressure at the ocean floor, physicist and recreational scuba diver Maxim Umansky of the Lawrence Livermore National Laboratory (LLNL) estimates that Okene's air pocket had been compressed by a factor of about four, according to a LLNL statement.

If the pressurized air pocket were about 216 cubic feet (6 cubic m), Umansky reckoned, it would contain enough oxygen to keep Okene alive for about two-and-a-half days, or 60 hours.

But there is an additional danger: carbon dioxide (CO2), which is lethal to humans at concentrations of about 5 percent. As Okene breathed, he exhaled carbon dioxide, and levels of the gas slowly built up in his tiny air chamber.

Carbon dioxide, however, is also absorbed by water, and by splashing the water inside his air pocket, Okene inadvertently increased the water's surface area, thereby increasing the absorption of CO2 and keeping levels of the gas below the deadly 5 percent level. [14 Oddest Medical Cases]

Hypothermia: a slow death

Another risk for Okene was hypothermia, which occurs when a person's core temperature drops to 95 degrees Fahrenheit (35 degrees Celsius) or below. Hypothermia can result in confusion, movement disorders, amnesia and, in severe cases, unusual behaviors like "terminal burrowing," in which a person struggles to find a small, enclosed shelter, not unlike a hibernating animal.

Death can eventually result from extreme hypothermia. Even in water as warm as 60 degrees Fahrenheit (16 degrees Celsius), a person could go unconscious within two hours, according to the University of Minnesota.

But once again, luck was with Okene: He was able to fashion a small platform with a mattress, which kept him just above the water level. Had his body been exposed to the frigid ocean water, Okene would have died within a matter of hours.

Looking for bodies

Dramatic video shows the moment salvage divers — who were looking for bodies and had already found four — saw a human hand motioning to them through an opening in the wreck.

After about 60 hours underwater, Okene was nearing the end of his oxygen supply. "This man was lucky to survive mainly because a sufficiently large amount of trapped air was in his air pocket," Umansky said in the LLNL statement. "He was not poisoned by the CO2 after 60 hours spent there, because it stayed at safe levels, and we can speculate that it was helped by the ocean water sealing his enclosure."

After almost three days of desperately hoping, praying and reminiscing about family and friends, Okene was finally brought to the surface in a decompression chamber by the salvage divers. He had no idea, however, how much time had passed.

"When we came out, I saw the stars in the sky and I thought I must have been in the water for the whole day," Okene told The Nation. "It was after I left the DCC [decompression chamber] that I was told that I had spent over two days there."

Follow Marc Lallanilla on Twitter and Google+. Follow us @livescience, Facebook & Google+. Original article on LiveScience.