The game-winning kick made up for a miss earlier in overtime for Zuerlein, who connected on his seventh try of 50 or more yards this season as the Rams (5-6-1) remained unbeaten against NFC West opponents.
The 49ers' David Akers also missed a potential game-winning kick in the extra frame, narrowly misfiring on a 51-yard try with 4:11 left.
San Francisco's Colin Kaepernick (21-of-32, 208 yards) committed a costly turnover late in regulation when his lost fumble resulted in a tying touchdown and two-point conversion for the Rams.
The 49ers (8-3-1) had been unbeaten in five games.
Costly malfunction causes beer flood at Boston-area brewery
Megyn Kelly: Santa Claus and Jesus are both white men