China's gymnasts stormed to the men's team gold at the Olympics while Japan lodged a last-gasp appeal to walk away with silver ahead of Britain on a dramatic evening in London.
Two days after finishing a lowly sixth in qualifying, China pulled themselves together to retain their title with a score of 275.997.
Japan were in second place going into the final rotation but appeared to have dropped out of the medals when Kohei Uchimura, the last man to compete, completed a messy dismount from the pommel horse to draw a low score from the judges.
That sparked loud celebrations among the British fans as it meant their team had finished second, with Ukraine third.
Japan, however, lodged an appeal against Uchimura's score and all eyes turned to the giant screen above the arena as gymnasts, fans and media waited for news.
For nearly 15 minutes, officials huddled in deliberation before announcing that Uchimura's pommel horse score had been increased by 0.7 points, bumping Japan up to silver medal position, 0.241 ahead of Britain who were demoted to bronze.
Ukraine, who had already been celebrating before the appeal was announced, were pushed out of the medals into fourth place.
The crowd booed the judges as they left the arena but Britain's gymnasts still had big smiles on their faces, knowing they had won their first Olympic team medal in a century.
In all the late drama, the disappointment of the United States team went almost overlooked. Top dogs in qualifying, they had a series of mishaps and ended up fifth.
On the pommel horse, John Orozco lost his rhythm and sat for a moment on the end of the apparatus, while Danell Leyva came off altogether. Orozco looked close to tears afterwards, and again after a disappointing vault.
Japan had to overcome a major mishap of their own when Koji Yamamuro was injured as he crash-landed on to his knees and head from the vault.
Yamamuro, all-around bronze medallist at last year's world championships, hopped off the competition podium on his right foot and was given a piggy-back ride out of the arena by a team coach. He had been due to also compete on the pommel horse but his place was taken by Kazuhito Tanaka.
When Japan came out for the medals ceremony, Yamamuro was carried between two team mates and hopped to his place on the second step of the medals podium.
Yamamuro's injury may jeopardise his participation in Wednesday's all-around individual final and the vault final next Monday.
China's consistent scoring allowed them to take the lead after the second rotation and the world champions looked back.
Chen Yibing contributed a 15.800 on the rings, the apparatus he has won Olympic and world gold on, and Feng Zhe had 16.216 on the vault.
Guo Weiyang, a late substitute for 2004 Olympic pommel horse champion Teng Haibin who was injured in training earlier this month, had been blamed by team mates for the poor qualifying showing but he proved his worth on Monday with 15.200 on the parallel bars.
Britain started strongly with 15.966 on the pommel horse from 2008 Olympic bronze medallist Louis Smith, a score that remained unbeaten for the rest of the day.
Sam Oldham's fall from the horizontal bar cost them but they were still able to clinch the nation's first team medal since a bronze at the 1912 Games.
As Britain were lining up with China and Japan for the medals ceremony, Ukraine's dejected gymnasts trooped dejectedly past waiting media without speaking.
Coach Yuliy Kuksenkov did stop to talk though, telling reporters: "They did well, they fought, they competed, but unfortunately some kind of subjectivity got in the way of today's competition, probably that played a role.
"The boys deserved a medal ... I think we deserved silver."