ST. LOUIS — It was in the hours before the 49ers beat the St. Louis Rams 17-16 Sunday that running back Frank Gore missed his mother the most.

“My mom and I always talked when I’d get to the stadium,” said Gore, whose mother, Liz Gore, died at 46 of kidney disease last Wednesday.

“I just kept looking at my phone. I shed some tears, but I had decided to play. I had to do my best for my team, and I know my mom is up above with God and I’m going to be all right.”

Gore did all right by his mom, helping the 49ers to their first 2-0 start since 1998 before leaving after the game for Miami to attend his mother’s funeral.

Gore ran for 81 yards and two touchdowns, including a game-turning 43-yard effort on a fourth-and-one play to give the 49ers a 14-13 lead — their first of the game — with 2 minutes, 43 seconds remaining in the third quarter.

With the Rams defense overloading the line of scrimmage, Gore ran into a couple of defenders right after getting the ball. But he shook free, faked his way past the safety and suddenly was running in the clear.

“We were just hoping to get the first down,” said guard Justin Smiley, who pulled to throw a key block on the play. “We weren’t thinking about the touchdown right there.”

Neither were the Rams, who nearly dealt the 49ers another setback in St. Louis despite having to play with an undermanned defense and an offensive line reconfigured due to injuries.

“That long touchdown run took the wind out of our sails,” Rams nose tackle Clifton Ryan said. “A couple of guys had a shot at him, but they weren’t able to bring him down. He is an All-Pro running back, and it takes more than one guy to bring him down.”

Gore was thinking he had some extra help breaking all those tackles on his way to crossing the goal line.

“She had to be with me on that one,” Gore said.

Gore had missed Thursday’s practice after learning of the death of his mother, who had raised him and two younger siblings on her own in one of Miami’s tough inner-city neighborhoods. He took part in the 49ers’ final practice Friday and said he planned to play because that’s what his mother would have wanted. He’s expected to return from the funeral Wednesday.

“It was emotional, and it had be hard. I can’t imagine,” Smiley said. “But the guy is a champion. To me, he’s the best running back in the NFL. He misses a day of practice and a day of installation because of this difficult time, and he comes out and makes something out of nothing, but that’s what he does. I’m sure he made his mom proud.”

For a while, it looked like Gore’s emotional effort would go for naught. Rams quarterback Marc Bulger threw for 368 yards and six times completed passes of 20 or more yards to his receivers.

But he was also taking a beating from an aggressive 49ers defense that got through a banged-up offensive line to sack him six times. It also forced the turnover leading to Gore’s second touchdown run.

Cornerback Nate Clements was beaten by Torry Holt for a reception downfield but chased him down and punched the ball out of his grasp. It rolled into the end zone and out of bounds for a touchback, giving the 49ers the ball at their 20.

“You never give up on a play,” Clements said. “I just kept running, saw the ball and punched it out. I work on that every day in practice, and it showed up in the game today.”

Clements seemed unfazed by the passing yardage racked up by Bulger.

“That’s OK,” he said. “The most important statistic is the ‘W.’ He could get as many yards as he wanted to, but he lost today.”

Still, the 49ers had to hang on for their second consecutive win against a division opponent. They survived a 56-yard field goal attempt by Jeff Wilkins with about a minute left that was on target but just short. Wilkins had three field goals on the day, including a 53-yarder that put the Rams back in front 16-14 with 10:04 remaining.

It was set up by a turnover by Alex Smith, who had a rough afternoon overall. He took four sacks and failed to generate any offensive consistency against a Rams defense that was without its top two cornerbacks because of a suspension and injury.

Ryan pushed Eric Heitmann back on a bull rush, jumped over him and swatted the ball from Smith, who was 11-of-17 for 126 yards, as he cocked to throw. The Rams defensive tackle recovered at the 46-yard line, but St. Louis managed to advance just 7 yards and brought on Wilkins.

Another turnover put the 49ers back on top. St. Louis’ Dante Hall couldn’t handle an Andy Lee punt, and cornerback Marcus Hudson flew into a pile to recover it at the Rams’ 26.

The 49ers ran the ball three straight times, and Nedney came on to kick the go-ahead 40-yard field goal.

Nolan, who had gone for it on fourth and one without hesitation earlier, took a more conservative approach after the Rams’ late turnover.

“As soon as it happened, I thought, ‘You know what? We just gave them three with Alex’s fumble, let’s kick the three back,'” Nolan said. “Let’s just take our one point up. Let’s just swap those things out. And I’m glad we did that, because we won the game.”

Violent police encounters in California last year led to the deaths of 157 people and six officers, the state attorney general’s office said Thursday in a report that provides the first statewide tally on police use-of-force incidents.

At 6:03 p.m. Wednesday, police responded to reports of the robbery at the facility, 2301 Bancroft way, and learned that a man who snuck into the facility and began prowling through the building, taking cell phones and wallets from victims.

Investigators’ efforts to solve the case led to the arrests of Pablo Mendoza, 25, of Hayward, Brandon Follings, 26, of Oakland and Valeria Boden, 26, of Alameda, the Alameda County Sheriff’s Office said Thursday.