By Pritha Sarkar

RIO DE JANEIRO (Reuters) - Kohei Uchimura left it late - very, very late - before a heart-stopping final horizontal bar routine lifted him into the pantheon of greats as he became the first gymnast in 44 years to win back-to-back Olympic all around titles on Wednesday.

In the end, all it took was a razor-thin 0.099 of a point to separate triumph and disaster.

A day after the American women romped to the team title by more than eight points, Uchimura, Oleg Verniaiev and Britain's Max Whitlock provided the kind of edge-of-the-seat drama that tore everyone's nerves to shreds.

Going into the final round, it seemed as if the unthinkable would happen and the man who has been unbeaten in the event since picking up a silver in the 2008 Olympics would be knocked off his perch by Verniaiev.

In a high-quality contest devoid of falls and spills by the top contenders, Verniaiev led the standings from the third rotation and held a 0.901 of a point lead over the Japanese great ahead of their final apparatus, the horizontal bar.

When Uchimura, who fell from the bar during qualifying, earned 15.800 with his high-flying routine that drew a chorus of "oohs" and "ahhs" each time he performed one of his four release and catch maneuvers, it left Verniaiev needing to overhaul a target of 14.899.

Having amassed 15.133 in qualifying, the 22-year-old Ukrainian knew the gold was within touching distance.

Verniaiev raised his fist after completing his dismount with a wobble and clutched the Ukrainian badge on his vest as he urged the crowd to cheer him as he waited for his total to flash up on the giant screen in the Rio Olympic Arena.

When a score of 14.800 denied him the top prize by the narrowest of margins, he gave a rueful smile and raised both palms upward as if to say "What more could I do?"

There is not much you can do when you run into a man who is fast running out of fingers to count the number of all around titles he owns.

"Six world championships and two Olympic wins in eight years is a great victory. I've raised the bar," said the champion, who unfurled eight fingers one-by-one to confirm his haul.

Verniaiev simply could not have done more.

"I was so close to gold... but I’m quite happy I managed to make Kohei very, very nervous," quipped the Ukrainian.

"He is the Michael Phelps of gymnastics. Competing with a guy who has not given up his title since 2009 is amazing. I just want to be as close as possible to beat him. I'll beat him next time."

The only consolation for Verniaiev was that he had pushed King Kohei like no other challenger has during his remarkable reign - with Wednesday's victory marking the slimmest margin of all his eight global triumphs.

"He is the king of gymnastics. But I have come as close as possible to him as nobody has before," summed up Verniaiev.

Close... but not close enough.

Uchimura became only the fourth man, and the first since his compatriot Sawao Kato in 1972, to capture successive golds in the event that tests skills across six apparatus. The 27-year-old, who also won the team title two days ago, joins Kato as the only men to win three Olympic all around medals, with both owning two golds and a silver.

Uchimura won with a total of 92.365.

The battle for bronze was equally compelling as Whitlock trumped Russia's David Belyavskiy by a negligible 0.143 of a point to become the first British man in 108 years to win an all around medal with a total of 90.641.

(Reporting by Pritha Sarkar; Editing by John O'Brien and Andrew Hay)