SANTA CLARA, Calif. (AP) — Three weeks after one of his best performances of the season against St. Louis, Colin Kaepernick fell flat on his back in one of his worst.
His offensive line left him little chance. The San Francisco 49ers are fumbling away key opportunities in the NFC West.
Kaepernick lost the ball at the goal line with 2 seconds left trying for the go-ahead score, and the Rams sacked him eight times on the way to a 13-10 upset of San Francisco on Sunday.
The play was reviewed and upheld. If Kaepernick had maintained possession, the 49ers could have used their final timeout to try for the touchdown again, or attempt a field goal to tie.
"I know I crossed the line. I was looking into the end zone," Kaepernick said. "The ball came out. I have to hold on to it."
St. Louis is doing plenty to influence the West race, beating defending Super Bowl champion Seattle on Oct. 19 and the 49ers two weeks later — by a combined five points.
Greg Zuerlein kicked the go-ahead 39-yard field goal for the Rams (3-5) with 5:25 left, then San Francisco got another chance.
Kaepernick started the last drive with 3:11 remaining from the 49ers 12. He completed long passes to Stevie Johnson and Anquan Boldin. Trumaine Johnson helped San Francisco get closer with back-to-back pass interference and holding penalties as he defended Michael Crabtree.
On third-and-goal from the 1, Kaepernick bobbled the snap, controlled it and dove between his blockers as fullback Bruce Miller tried to shove him into the end zone. Kaepernick fumbled as he went down in the mass of bodies, apparently short of the goal line.
James Laurinaitis came away with the ball.
"I just went to kind of meet him head to head down there and as I'm going down, I just see the ball sitting there," he said. "Jo-Lonn (Dunbar) did a great job recognizing sneak. You can just kind of tell by a quarterback's mannerisms when they're going to sneak."
Afterward, referee Jerome Boger said, "there was nothing we could see that could change the ruling on the field."
The Rams, 9 1/2-point underdogs to start the week, never let Kaepernick get comfortable. The quarterback spent more time on his backside and running from St. Louis defenders than he did directing the offense.
Playing for the second time in 21 days, the teams both were coming off embarrassing routs — the Rams last week 34-7 in Kansas City and the 49ers 42-17 at Denver on Oct. 19 — and this wasn't pretty, either.
"We have all the talent in the world. We've been doing some dumb stuff and they took advantage of it," 49ers left tackle Joe Staley said. "Penalties, dumb blocks, dumb techniques, and dumb schemes."
The Niners did little to impress members of the World Series champion San Francisco Giants in the stands wearing 49ers gear. Former coach George Seifert was in attendance as well for his induction into the franchise Hall of Fame.
"We have to play good football in order to win in this league, there's no question about it," 49ers coach Jim Harbaugh said. "Today was not good enough to win."
A crazy final play to end the first half was upheld on replay review.
When Phil Dawson's 55-yard field goal try came up well short, Tavon Austin caught the ball near the back of the end zone and brought it out a few yards before backtracking to try to get around the right edge.
Derek Carrier tackled Austin in the end zone as the first-half clock expired.
As the two teams headed for their respective locker rooms, the head coaches stayed put for the ruling, which was that forward progress was stopped in the field of play and the play stood without a safety.
Kaepernick threw a 27-yard touchdown pass to Boldin, giving him TD passes in 15 straight games — tied for the second-longest streak in franchise history with Jeff Garcia. Hall of Famer Steve Young had 17 in a row.
When the NFC West rivals first played Oct. 13, Kaepernick threw for 343 yards and three touchdowns with no interceptions or sacks. He finished Sunday with 237 yards on 22-of-33 passing.
San Francisco struggled to get pressure on Davis, while missing star linebacker Patrick Willis for the second straight game with an injured left big toe.
"We've just got to look at ourselves in the mirror and we're going to try to get to this postseason," running back Frank Gore said. "We've got to go do it and stop playing around."
Notes: San Francisco LB Dan Skuta (left ankle) and WR Brandon Lloyd (hamstring) also made early exits. ... Rookie 49ers LB Chris Borland had 18 tackles, 15 solo, playing in place of Willis.