SAN FRANCISCO — Win or lose, the 49ers usually leave the field thinking they've given their best efforts.

But a tie? That's uncharted territory for most of these guys.

"First time ever," veteran center Jonathan Goodwin said after the Niners' 24-24 deadlock against the visiting St. Louis Rams. "Baseball as a kid, anything, I don't remember finishing a game tied. It almost felt basically like we got a practice."

The 49ers need some more of that after this five-quarter, 3-hour, 50-minute rumble. They fell behind by two touchdowns practically before the fans were in their seats, surrendered not one but two first downs on fake punts and very nearly got torched for a game-winning touchdown by the Rams in overtime.

And there are even larger issues. Starting quarterback Alex Smith left the game with a concussion midway through the second quarter. He injured himself diving for a first down on fourth-and-1 at the St. Louis 48-yard line, and finished the drive with a 14-yard touchdown pass to Michael Crabtree before admitting to coaches that his vision was blurred.

It was Smith's second concussion in two years. He sustained one against Dallas in Week 2 last season, but played the following week at Cincinnati. With the aggressive Chicago Bears' defense looming next Monday night, the 49ers are hoping Smith can make another fast recovery.

Second-year backup Colin Kaepernick took Smith's place in the huddle and mostly performed well, erasing the 14-7 deficit he inherited and leading to 49ers to three fourth-quarter scores.

"If I had to rate Colin, I'd give him a B-plus," tight end Vernon Davis said. "I think he went out there and he did a spectacular job, just taking over for Alex. He made plays. I mean, he was on it. He was cued in. He was focused. And he wanted to help this team win."

After all that, it looked like St. Louis had stolen a victory when Sam Bradford and wide receiver Danny Amendola connected on an 80-yard pass play on the first play of overtime, beating Carlos Rogers down the right sideline. Safety Donte Whitner pushed Amendola out at the 2-yard line, but as the Rams celebrated their opportunity, a flag came down near the line of scrimmage.

Officials hit St. Louis with an illegal-formation penalty, explaining to coach Jeff Fisher later that a wide receiver was off the line, leaving left tackle Rodger Saffold "uncovered."

The 49ers had a chance of their own at 8:14 of the extra period, but David Akers, the team's trusted placekicker, pushed a 41-yard field-goal attempt just wide of the left crossbar. And with 2:35 left, Rams kicker Greg Zuerlein knocked a 53-yard try down the middle, only to see it negated by a delay of game penalty. He missed from 58 yards on the next snap.

The game devolved into a slog thereafter, neither offense able to break through. It ended with a whimper, Bradford connecting with Brandon Gibson for a meaningless 24-yard gain as the clock went to zeroes, giving the Niners their first tie since a 10-10 result at Atlanta on Oct. 19, 1986.

San Francisco retained its lead in the NFC West at 6-2-1. The Rams are at 3-5-1. Their records will remain elongated for the rest of the season.

Afterward, both locker rooms struggled to make sense of the draining, frustrating contest.

"It was a roller coaster," Rams defensive end Chris Long said. "I feel like we won two games, maybe lost one and tied one today. It was unbelievable."

"Don't feel like anything," Davis said. "Feels like we didn't even play — mentally, not physically."

Early in the fourth quarter, it looked like the Niners had finally asserted themselves. Kaepernick finished an 81-yard drive by diving to the right flag for a 7-yard touchdown run, and the Rams immediately coughed up the ball on a fumble by return man Isaiah Pead on the ensuing kickoff. Frank Gore capitalized by zipping around right end for a 20-yard touchdown on the next play, giving his team a brief 21-17 lead.

But the 49ers, who came into the game ranked No. 2 in the NFL in total defense, could not hold against the Rams, who were ranked No. 28 in total offense. St. Louis mounted a 14-play, 81-yard drive to regain the lead, finishing on Bradford's 2-yard scoring throw to Austin Pettis in the back of the end zone.

Down 24-21, San Francisco was fortunate to tie the game at the end of regulation on Akers' 33-yard field goal.

The 49ers made enough big plays to get back in this game, even with an inexperienced quarterback at the helm. But they were hard-put to explain their lethargic start. The last-place Rams opened the game on fire. The 49ers opened as if they had spent their bye week watching daytime TV and drinking shots of tequila.

St. Louis scored on its first two possessions, the first strike coming on a 36-yard touchdown pass from Bradford to rookie Brian Quick, who started the play by knocking cornerback Chris Culliver on his backside. The second drive was capped by Steven Jackson's 7-yard scoring run. Just like that, the underdog Rams were up 14-0.

The easy explanation would be to say the 49ers were rusty after not having played for 13 days. Most of them felt it had more to do with a determined opponent, and a strange set of circumstances.

"We have one of the best kickers in the game, and it comes down to the end and he misses it by a little bit. You say to yourself, &‘Whoa, that's not right,'" linebacker Patrick Willis said. "And then I like to say our defense is one of the best defenses in the game, and today we wasn't clicking. ... But no excuses. We didn't win the game — nor did we lose."

You can reach Staff Writer Phil Barber at 521-5263 or phil.barber@pressdemocrat.com.