"I have to say, I've been doing this a while. I don't think I've ever been in a game like this," Rams coach Jeff Fisher said. "As I told our guys, we had a number of chances to put the game away. And, unfortunately, we didn't."
San Francisco's David Akers missed wide left on a 41-yard attempt that could have sealed it for the 49ers (6-2-1), who lost QB Alex Smith to a first-half concussion.
Greg Zuerlein kicked a 53-yarder, but the Rams were penalized 5 yards for delay of game which holder Johnny Hekker said was his fault. Zuerlein tried again from 58 as Fisher played for the win, and missed wide right with 2:42 left in OT.
And just when it seemed the 49ers and Akers' typically reliable left leg would have one more chance to win it, San Francisco linebacker Patrick Willis was flagged for holding Lance Kendricks on third down. That extended St. Louis' last drive, a costly mistake in a long list of them on an uncharacteristically sloppy day by coach Jim Harbaugh's team.
"I don't know what to make of this," Willis said. "We have one of the best kickers in the game, and it came down to him at the end and he misses it. That tells you right there something wasn't right."
Akers booted a tying 33-yarder with 3 seconds left in regulation after Sam Bradford threw a 2-yard touchdown pass to Austin Pettis with 1:09 remaining.
On the first play of OT, Bradford completed an 80-yard pass to Danny Amendola that took St. Louis (3-5-1) to the 2, but the play was called back for an illegal formation. Some 49ers fans got up to leave, then returned to their seats.
The last tie was between Philadelphia and Cincinnati, 13-13 in 2008. San Francisco played its first tie since 1986.
Frank Gore ran for a 20-yard touchdown with 8:23 to go in regulation just 17 seconds after backup quarterback Colin Kaepernick scurried 7 yards for a score. Kaepernick finished 11-for-17 for 117 yards and also had eight carries for 66 yards, calmly leading the Niners after it took several series to find his groove.
"It just feels like it's unfinished business," San Francisco cornerback Tarell Brown said.
Gore ran for 97 yards, while Michael Crabtree made five catches for 70 yards and a 14-yard TD from Smith before he left the game.
Amendola returned for the Rams following a three-game absence with a shoulder injury to make 11 catches for 102 yards. Bradford went 26-for-39 for 275 yards and two touchdowns.
Smith took a hard hit on the back of the neck from linebacker Jo-Lonn Dunbar after a scramble with 1:10 left in the first quarter. But the No. 1 overall pick in the 2005 draft out of Utah stayed in and completed his next five passes, including Crabtree's TD.
After the hit, Smith was sacked three plays later and also clobbered again on a fourth-and-1 keeper. Doctors indicated to Harbaugh that might have been the play that caused injury.
Harbaugh said Smith would be evaluated this week per NFL concussion protocol. He wasn't available to speak to reporters. Smith, who has started 28 straight games, wound up 7-for-8 for 72 yards.
Crabtree's touchdown midway through the second quarter gave him a TD reception in five straight games against the Rams. It was his third touchdown in two games, and all of his team-leading four TD catches have come in the last five games.
Kaepernick took over as Smith went to the bench to be examined by medical personnel and soon left for the locker room.
P Kansas City at Pittsburgh, 6:30 p.m., ESPN