Trailing 10-3, the 49ers notched 21 straight points in the final frame to put the game away.
Smith ran it 1 yard into the end zone with 11:51 left to forge a 10-10 tie and the 49ers took the lead for good 4 minutes later when he engineered a 48-yard drive, capped by a 28-yard touchdown pass to Michael Crabtree.
The 49ers (2-6) iced the game when signal-caller Kyle Orton fumbled on the Broncos' ensuing possession and Takeo Spikes recovered it at the Denver 18. Frank Gore picked up 15 yards on four carries on the ensuing possession, including a TD run for a 24-10 San Francisco lead.
Smith finished the game 12-of-19 for 196 yards and Gore piled up 118 yards on 29 carries.
Orton went 29-of-40 for 369 yards, one touchdown and one interception for Denver (2-6).
Brandon Lloyd hauled down seven catches for 169 yards and a score in the Broncos' loss.
Gal Gadot cast as Wonder Woman for 'Batman vs. Superman'
Exploding whale video goes viral on Internet