ST. LOUIS -- The Monday night lights sure agree with the San Francisco 49ers.
Quarterback Colin Kaepernick threw for three touchdowns and 343 yards as San Francisco overcame a 14-0 first-quarter deficit for its seventh straight Monday night win, a 31-17 verdict over the St. Louis Rams at the Edward Jones Dome.
Kaepernick gave the 49ers their first lead with 9:58 left in the third quarter, avoiding a sack and rolling to his left before flinging an 11-yard scoring strike to wide receiver Anquan Boldin.
Kaepernick added his third touchdown pass with 13 seconds remaining in the period, hitting wide receiver Michael Crabtree on a 22-yard dart over the middle. Kaepernick connected on 22 of 36 attempts.
It was the third straight win for San Francisco (4-2), which jumped over Seattle for second place in the NFC West. But it came at a cost as the 49ers lost linebacker Patrick Willis (toe), left guard Mike Iupati (concussion) and backup free safety Jimmie Ward (quad) to injuries.
St. Louis (1-4) dropped its third straight game and fell to 0-3 at home. After throwing for 103 yards and a score in the first quarter, quarterback Austin Davis finished just 21 of 42 for 236 yards, getting sacked five times.
Placekicker Greg Zuerlein hit a 38-yard field goal with 2:24 left to pull the Rams within seven. St. Louis got the ball back with 1:05 remaining at its 9, but cornerback Dontae Johnson intercepted Davis and returned it 20 yards for a clinching touchdown with 53 seconds left.
The Rams started the game with an 11-play, 80-yard touchdown drive, scoring when running back Benny Cunningham ran a yard off left tackle on third-and-goal with 7:55 left in the first quarter.
St. Louis made it 14-0 with 53 seconds remaining in the quarter when Davis hit tight end Lance Kendricks with a 22-yard scoring strike off play-action. It came four plays after San Francisco tight end Vance McDonald fumbled to linebacker James Laurinaitis after a hard hit by free safety Rodney McLeod.
Placekicker Phil Dawson got the 49ers on the board with 7:07 left in the first half, drilling a 54-yard field goal.
San Francisco stunned the St. Louis portion of the bipartisan audience with 14 seconds remaining before halftime. Kaepernick lofted an 80-yard touchdown pass to wide receiver Brandon Lloyd, who ran past cornerback Janoris Jenkins, to slice the Rams' halftime lead to 14-10.
NOTES: San Francisco TE Vernon Davis (back) was able to play, but starting RT Anthony Davis (knee/ankle) and CB Tramaine Brock (toe) were inactive. ... St. Louis LG Greg Robinson, the No. 2 overall pick in this year's draft, made his first start. Rodger Saffold moved to right guard, and Davin Joseph didn't start after getting the call in the first four games. ... The Rams paid tribute to the 1999 team that won Super Bowl XXXIV, wearing that year's uniforms and honoring several members of that squad.