SANTA CLARA, Calif. (AP) Jim Tomsula praised his players for delivering a win at season's end, then lost his job shortly after.
Phil Dawson kicked a 23-yard field goal 11:33 into overtime for his fourth of the game, and the 49ers held off the St. Louis Rams 19-16 on Sunday in Tomsula's finale.
His firing was announced about two hours after the game ended at 6:58 p.m. PST.
''Jimmy has been a valuable member of the 49ers organization for the last nine years,'' CEO Jed York said in a statement. ''We all know he is a man of high character, and his contributions on the field and in our community have always been greatly appreciated.
''This entire organization is proud and grateful to have worked so closely alongside Jimmy. We all wish him and his family great success in the future.''
York was scheduled to address reporters Monday morning.
''I'm not going to make this about Jim and Jim's job status here today,'' Tomsula said after the game.
''I got a group of guys here, players that just won a football game. They've been through a very tough season. They've stuck together. They went and won a game in overtime. They fought like crazy. And today is about those players. My job status, anything going forward there, can be handled throughout the rest of the week.''
Dawson came through after Greg Zuerlein's 48-yard field goal attempt was blocked by Dontae Johnson, giving San Francisco the ball back with 4:49 to play.
Blaine Gabbert passed for 354 yards and a 33-yard touchdown to Anquan Boldin for the 49ers (5-11), who avoided their worst finish since going 4-12 in 2005.
Rams coach Jeff Fisher finished 7-9 for his fourth straight losing season running the team and called it ''very disappointing.''
The 49ers ran out and swarmed Dawson after the winning kick. Tomsula smiled in his postgame news conference following this one.
''I've been with Jimmy my whole career. I love Jimmy,'' said linebacker NaVorro Bowman, who finished his comeback season from a major knee injury with 154 tackles. ''Today we won a game, let's give him some praise for that.''
Free agent to-be Dawson - who turns 41 later this month and wants to return for an 18th season - also kicked a tying 38-yard field goal with 4:33 remaining.
St. Louis punted on its next possession. Then, after left guard Andrew Tiller's false start, Boldin caught a 27-yard pass with Gabbert under pressure late but San Francisco ended up punting from the 37 with 1:39 left.
After seeing what happened to Zuerlein moments earlier in OT, Dawson wasn't counting on anything coming easily.
''I'm sure people were thinking, `Oh, it's just a no-brainer,' but I'm trotting out there thinking, `I've missed one shorter than this, we've given up a couple blocks this year,''' Dawson said. ''You know they're going to be bringing the heat. It's not a gimme.''
For the Rams, this loss came after a week in the Northern California wine country between West Coast games - and now the biggest question facing the franchise: Will the Rams relocate to Los Angeles for next season?
''Until we know what's going on, there's no reason to discuss it,'' Fisher said. ''You just wait it out and see what happens. I've been through this before.''
Boldin knocked down cornerback Janoris Jenkins on his TD catch 8 seconds into the second quarter. Dawson kicked a 26-yard field goal in the second quarter and a 28-yarder in the third.
Before Dawson came through with his foot, reigning NBA MVP Stephen Curry of the champion Golden State Warriors drew the biggest cheers of the day when shown on the big screen in the third quarter. He obliged with a wave and a smile.
Some of the same problems that plagued the 49ers all season showed up in the finale: penalties, mistakes and ineffective play on both sides of the ball, but St. Louis struggled, too - with Zuerlein also missing an earlier field goal. San Francisco got booed at home in Levi's Stadium yet again.
''Even in a bad season like this, nobody pointed fingers,'' safety Eric Reid said. ''The mood in the meeting rooms was always good. That's something that we can be happy about.''
Late in the second quarter, Gabbert had a pass tipped by Aaron Donald and Eugene Sims made the interception and returned it 42 yards. Tre Mason ran for a 4-yard score two plays later.
Then in the waning minutes with a chance for a go-ahead touchdown on third-and-goal, Gabbert made an errant pitch backward to DuJuan Harris for a 12-yard loss before Harris pounced on the ball.
Harris had eight catches for 86 yards and Boldin five for 71.
Case Keenum went 22 of 37 for 231 yards as St. Louis had its three-game winning streak snapped as the Rams tried for four consecutive victories for the first time since seven straight in 2003.
''It really wasn't about getting to 8-8,'' defensive end Chris Long said. ''Our goal this season was bigger than 8-8.''
NOTES: Injured 49ers QB Colin Kaepernick watched from the sideline. He is recovering from surgery on his non-throwing left shoulder. ... Rams LB Daren Bates suffered a knee injury.
AP NFL website: www.pro32.ap.org and http://twitter.com/AP-NFL