SANTA CLARA, Calif. (AP) St. Louis quarterback Austin Davis had begun mentally preparing for the 2-minute offense if San Francisco took the lead or tied it on a field goal.
Wide receiver Kenny Britt opted to say a little prayer that the defense would come through.
The Rams did just that, changing their goal-line look for the very possibility Colin Kaepernick might try to take it in himself with the game on the line.
St. Louis stuffed him yet again, Kaepernick coughed up the ball and James Laurinaitis recovered to seal the Rams' wild 13-10 victory over the 49ers on Sunday.
''They deserve it,'' Davis said about the defense. ''They won us the ballgame today.''
Defensive end Jo-Lonn Dunbar read Kaepernick perfectly.
''Jo-Lonn did a great job recognizing sneak,'' Laurinaitis said. ''You can just kind of tell by a quarterback's mannerisms when they're going to sneak.''
The play was upheld on review, though Kaepernick clearly thought he was in the end zone with a winning touchdown for the Niners (4-4).
''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.''
Last-place St. Louis (3-5) sure is throwing a wrinkle into the NFC West race after victories over defending Super Bowl champion Seattle two weeks ago and then the 49ers - by a combined five points.
Here are some things of note from the Rams' victory at Levi's Stadium:
UNDER REVIEW: A pair of reviewed calls played heavily into the outcome.
Referee Jerome Boger found himself answering the questions afterward, noting on the final play ''there was nothing we could see that could change the ruling on the field.''
The first half ended in strange fashion.
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.
MISSED CHANCES: The 49ers realize they can't afford to lose games like this and stay in the West race. They still have two games with Seattle - including Thanksgiving night at home - and a season-ending matchup against Arizona.
San Francisco, which has reached three straight NFC championship games, sits in third place.
''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.''
MARTIN'S DEBUT: Marcus Martin picked up a blitz on the 49ers' initial drive, leading to a 15-yard catch by Crabtree.
But on the next series, Martin had a bad snap on third down that was low and forced Kaepernick to grab the ball near his shoestrings.
The rookie center had his share of growing pains in his NFL debut. He replaced injured starter Daniel Kilgore, lost for the season to a fractured left ankle that required surgery.
Martin got beat several times, too, including on Laurinaitis' sack up the middle on the first play of the second quarter.
''They brought a lot of pressure,'' Martin said. ''They have a good front seven.''
Veteran left tackle Joe Staley also struggled to protect Kaepernick.
''We have all the talent in the world. We've been doing some dumb stuff and they took advantage of it,'' Staley said. ''Penalties, dumb blocks, dumb techniques, and dumb schemes.''
SACK-HAPPY RAMS: The Rams came into the game with six sacks all season, then took Kaepernick down six times in the first half alone on the way to eight total sacks by six players.
Robert Quinn had a pair of second-quarter sacks and forced Kaepernick into a lost fumble on one that set up St. Louis' touchdown.
''We threw a couple different looks at him,'' Quinn said. ''The D-line rushed their tails off. When we had an opportunity to get him down, we found a way. Against a guy like him, if you miss him, he can strike off 50-60 yards.''
BORLAND'S TACKLES: Rookie Chris Borland had a career day on an otherwise forgettable afternoon for San Francisco.
The rookie third-round draft pick did a fine job filling in for injured linebacker Patrick Willis, who missed his second straight game with a strained muscle in his left big toe.
Borland had 18 tackles with 15 solo tackles.
He has benefited in the meeting room with Willis and injured All-Pro NaVorro Bowman.
''Our defense played better overall but just a sour taste in my mouth,'' Borland said.
AP NFL website: www.pro32.ap.org and www.twitter.com/AP-NFL