San Francisco gave up a home game to play in London, and they were rewarded with the raucous support of the majority of the 83,941 fans.
After the game, 49ers cornerback Shawntae Spencer said: "We got to get an NFL team over here. The energy is unbelievable. The fans, the wave, the flags. It really felt like a home game tonight."
In an electric atmosphere, former Destiny's Child singer Michelle Williams sang the US national anthem and guitar legend Jeff Beck played an instrumental version of God Save the Queen.
Distance runner Mo Farah and three-time Olympic sailing gold medallist Ben Ainslie acted as honorary captains for the Broncos and 49ers respectively.
But the biggest pre-game cheers were reserved for Niners legendary wide-receiver Jerry Rice and former Broncos great John Elway as they appeared on the Wembley turf for the coin toss shortly before kick-off.
San Francisco struck first, quarterback Smith - starting an NFL game for the first time since 2007 due to an injury to Alex Smith - leading a seven-and-a-half-minute drive that resulted in a 35-yard field-goal by veteran kicker Joe Nedney shortly before the end of the first quarter.
With the Broncos being booed by the partisan crowd on every possession, Denver's quarterback Kyle Orton - second in the NFL passing rankings with over 2,000 yards already this season - struggled to move his offence up the field despite completing 13 of 16 pass attempts in the first half.
Michael Crabtree celebrates scoring a touchdown in the second half
In a scoreless and uneventful second-quarter both teams failed to establish any dominance.
The crowd began to get restless as the third quarter got under way and a Mexican wave reverberated around the stadium only five minutes into the second half.
But the fans came to life when Orton completed a 71-yard pass to former 49ers wide receiver Brandon Lloyd to leave the Broncos with an easy scoring opportunity from the one-yard line.
Tebow's sneak gave Denver a 7-3 lead after the conversion, and with influential tight-end Vernon Davis ruled out of the second-half with an ankle injury Smith struggled to provide an aerial threat.
The Niners were playing a very one-dimensional and predictable game, with Gore handed the ball on the majority of plays.
After a promising drive broke down on the Denver 34-yard line, Nedney came within inches of reducing the deficit with a 52-yard field-goal but his kick struck the right post.
They were almost severely punished for the miss at the end of the third quarter.
A flea-flicker play by the Broncos ended with a 38-yard touchdown pass to wide receiver Jabar Gaffney but the play was nullified due to a chop block penalty on running back Knowshon Moreno.
With the Broncos in the ascendency, they extended their lead to 10-3 at the start of the fourth quarter when Matt Prater kicked a 32-yard field goal.
Cheerleaders provided extra colour for the Wembley spectators
It looked as though there was no way back for the 49ers with QB Smith struggling badly, but the game shifted momentum in spectacular fashion in the fourth quarter.
A speculative pass to Delanie Walker resulted in an unlikely 38-yard completion and Smith completed the drive with a one-yard run to level the score at 10-10.
The 49ers responded to a rejuvenated crowd and scored again several minutes later after a 28-yard touchdown pass from Smith to Crabtree gave San Francisco a 17-10 lead.
The momentum was now firmly with the team coached by the under-pressure Mike Singletary, and 49ers linebacker Manny Lawson stripped Kyle Orton of the ball deep in Denver territory on the next set of plays.
Takeo Spikes recovered the football and several plays later Gore bundled over for a deserved score.
The Broncos struck back with Lloyd's touchdown but a missed conversion - as Sprater shanked his attempt - left Denver with a mountain to climb with only two minutes remaining.
An interception by Spencer with 39 seconds left effectively ended the game and allowed them to leave London with a morale-boosting victory - just their second of the season.
Denver have now lost four games in a row and lie bottom of the AFC West.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.