ST. LOUIS (AP) -- It was the kind of play Dante Hall has made many times, camped under a punt, waiting to make the catch.
This time, late in the fourth quarter Sunday, he dropped it. Marcus Hudson recovered for San Francisco, setting up the winning field goal in the 49ers' 17-16 win over St. Louis.
"It was a routine play for me," Hall said. "I fair-catch it and call it a day."
The Rams' Jeff Wilkins missed a 56-yard field goal try with 59 seconds to play, the ball falling about a yard short of the goal post.
"He's got a good leg," 49ers coach Mike Nolan said of sweating out Wilkins' kick. "I wasn't thinking, 'Oh, we got this.'"
The 49ers (2-0) won despite struggling offensively most of the game. Alex Smith was 11-for-17 for 126 yards. Frank Gore scored two touchdowns and gained 81 yards on 20 carries, most of those coming on a play that helped turn the game around late in the third quarter.
St. Louis lost despite outgaining San Francisco 392 yards to 186. The Rams had 20 first downs to eight for the 49ers.
"We've got to find ways when we've got a lead, lead at halftime, lead in the third quarter, to sustain it," Rams coach Scott Linehan said. "You can't have opportunities and squander them. And we did."
The Rams were up 13-7 late in the third quarter and on the verge of another score when Torry Holt caught a pass at the San Francisco 10 and was stripped from behind by Nate Clements. The ball skipped into the end zone, then out of bounds, giving San Francisco the ball at the 20.
The 49ers' drive appeared to stall with a fourth-and-1 at the St. Louis 43, but coach Mike Nolan went for it. Gore took a handoff up the middle and got the first down after he appeared stopped by linebacker Chris Draft. But Draft lost his grasp of the running back, who ran to the end zone to make it 14-13.
"They had nine in the box -- everybody was up there," Gore said. "I got through and kept pumping my legs."
The Rams (0-2) went back on top early in the fourth quarter after defensive tackle Clifton Ryan swatted the ball loose from Smith, setting up Wilkins' 53-yard field goal.
Hall, a two-time Pro Bowl return man acquired in an offseason trade with Kansas City, appeared to have an easy catch on Andy Lee's kick, but the ball went through his hands, setting up Joe Nedney's 40-yard field goal with 3:28 to play.
"It was frustrating. I was just trying to make a play. I should have just fair-caught it," Hall admitted.
St. Louis had one final chance, getting the ball at its 20 with 1:53 to play and no timeouts. The Rams reached the San Francisco 45 with 1:15 to play when Linehan ordered quarterback Marc Bulger to spike the ball. After a 7-yard sack, Bulger hit Isaac Bruce, who had eight catches for 145 yards, for a 14-yard gain.
Rather than go for it on fourth-and-3, Wilkins tried what would have been the second-longest field goal of his career. His career best is 57 yards, but he is 24-for-34 in his 14-year career from 50 yards or longer.
Linehan regretted the first-down spike with more than a minute to play, but not the decision to kick.
"That's how much confidence I have in Jeff and he hit a great ball," Linehan said. "It just didn't carry far enough. I think I'd do it again."
Bulger was 24-for-41 for 368 yards and one touchdown and completed passes to seven receivers. Rams running back Steven Jackson gained 60 yards on 21 carries.
The Rams scored in the first quarter when San Francisco's Brandon Williams made an ill-advised decision to field a punt that was tailing away from him. Long-snapper Chris Massey recovered at the 49ers 25.
Five plays later, Bulger split two defenders and hit Holt with a 12-yard scoring pass.
Gore's 1-yard run on the first play of the second quarter tied the score.
Wilkins kicked second-quarter field goals of 27 and 29 yards to make it 13-7 at the half.
The 49ers had six sacks against a rebuilt Rams offensive line that was without left tackle Orlando Pace, out for the year with a shoulder injury, and guard Richie Incognito, who missed his second straight game with a high ankle sprain.
Roger Wehrli, the longtime St. Louis Cardinals cornerback who entered the Pro Football Hall of Fame this summer, was honored at a halftime ceremony, adding his name to the "Ring of Fame." ... Gore left immediately after the game and flew to Miami for his mother's wake on Monday and funeral on Tuesday. He'll return to San Francisco on Wednesday. Liz Gore died Wednesday in the Miami area. She had suffered from a kidney ailment. ... Bulger played the latter part of the game with sore ribs after taking several hits. ... The Rams still lead the all-time series 59-55-2. The series dates to 1950.