SANTA CLARA, Calif. (AP) — Colin Kaepernick fumbled at the goal line with 2 seconds remaining, and St. Louis sacked the San Francisco quarterback eight times on the way to a 13-10 upset over the 49ers on Sunday.

The Rams recovered, and the play was reviewed and upheld. The 49ers (4-4) had first-and-goal the 1 but blew it in the red zone and failed to capitalize on consecutive penalties by Trumaine Johnson as he defended Michael Crabtree.

READ MORE: Flash Flood Watches Issued As Storm Aims at Fire-Scarred Northern California

Greg Zuerlein kicked a go-ahead 39-yard field goal for the Rams (3-5) with 5:25 left.

San Francisco got the ball back with 3:11 remaining on its own the 12. Kaepernick completed long passes to Stevie Johnson and Anquan Boldin in the final drive.

READ MORE: Magnitude 2.8 Earthquake Rattles East Bay Near Hercules

[display-posts category=”trending” wrapper=”ul” posts_per_page=”6″]

TM and © Copyright 2014 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2014 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press contributed to this report.

MORE NEWS: New Facebook Whistleblower Says Executives Shrugged as Algorithm Stoked Hate, Misinformation