Jaroslav Kulhavy of the Czech Republic won the men's cross-country mountain bike, beating Nino Schurter of Switzerland in a sprint finish.
Marco Aurelio Fontana of Italy finished in the bronze medal position.
The two leaders were inseparable through the last circuit before Kulhavy pulled away on the final climb.
Great Britain's Liam Killeen was taken to hospital with what was later confirmed as a broken left ankle after crashing on boulders.
"It had it all that race. We had tragedy with Liam Killeen, with his broken ankle now confirmed. Then at the front, we had the guys fighting so hard, and there was nothing to choose between the final two at the end.
"We knew it was going to come down to that climb at the end, and not the sprint, as whoever went into that bend in the course in the lead would take the gold, and they knew it too. It was almost a photo finish at the end."
The Malvern 30-year-old, who enjoyed top-10 Olympic finishes in Athens and Beijing, was treated by medical staff at the bottom of Deane's Drop on the second lap before being taken to Homerton Hospital by ambulance.
"It was really hard at the end because we went full gas all the time," said Kulhavy. "I put everything into this this race, all my energy, I am amazed. This race was important, and now I have won everything."
Kulhavy took the lead on the fifth of seven laps on the 4.7km course and was later joined by Schurter and Fontana, with the Italian eventually falling out of contention for gold.
Schurter was in front until Kulhavy rounded him on the final climb and retained the lead in the closing downhill sprint.
Defending champion Julien Absalon of France, the 2004 and 2008 gold medallist, failed to finish after falling down the field following a puncture.