SAN FRANCISCO -- Just when it looked as if Atlanta would play spoiler in the Candlestick Park farewell, the ball bounced San Francisco's way and dealt the Falcons another crushing loss in a lost season.
NaVorro Bowman returned an interception 89 yards for a touchdown with 1:10 remaining to thwart Atlanta's potential winning drive and the 49ers clinched a playoff spot with a wild 34-24 victory Monday night in the likely final game at The Stick.
"We've had opportunities in a lot of football games this year," quarterback Matt Ryan said. "We just haven't found ways to win. Same thing tonight."
Eleven months after a narrow loss to the 49ers in the NFC championship game, the Falcons (4-11) are playing out the string of a disappointing season featuring six losses by seven points or less before this nail-biting finish.
Atlanta fought back from 10 points down when Ryan threw a 2-yard TD pass to Tony Gonzalez with 2:09 to play to make it 27-24. The Falcons recovered the onside kick and drove down to the 10 where they were in position to ruin a celebratory night for the 49ers (11-4).
"There was no doubt in my mind we were going to get the job done," Gonzalez said. "It hurts. It hurts bad. It's a tough one to swallow to lose that way."
Ryan threw a pass to Harry Douglas but Tramaine Brock arrived just as the throw did. The ball popped up in the air and Bowman grabbed it on his way to the end zone for the clinching score that sent San Francisco to the playoffs.
"When it popped up in the air, I was just hoping it hit the ground," Douglas said. "It's just one of those plays."
Ryan threw for 348 yards with two TD passes in the fourth quarter, including a 39-yarder to Roddy White as the Falcons rallied with nothing tangible at stake.
But the defense couldn't stop the 49ers even once in the second half, committing two key penalties that extended drives to help San Francisco overcome a 10-3 halftime deficit.
"The guys in that locker room are the most resilient guys I've ever been around," Falcons coach Mike Smith said.
Kaepernick ran for a 4-yard touchdown and threw a 10-yard TD pass to Anquan Boldin, and Frank Gore had a 1-yard touchdown run as the 49ers used a big second half to clinch a third straight playoff season and fifth consecutive victory. They put up 169 yards in the third quarter after managing just 113 in the first half as the sellout crowd fell momentarily quiet.
San Francisco still has a slim chance at winning a third consecutive NFC West crown if St. Louis wins at Seattle and they beat Arizona on the road.
During an evening of fanfare and famous faces for The Stick's ceremonious farewell, Kaepernick took charge as his team made good on coach Jim Harbaugh's mantra for the week: "We don't want to be the guys who screw up the final game in Candlestick."
"Best birthday present I've ever gotten, second only to being born," quipped Harbaugh on his 50th birthday.
Boldin had a 10-yard touchdown catch that tied it at 10 with 12:03 left in the third, and Kaepernick ran for a score early in the fourth.
Michael Crabtree adjusted to make a 47-yard catch on an underthrown pass by Kaepernick in the third quarter, and then made a 19-yard reception on the play before Boldin's score.
Crabtree had five catches for 102 yards on a day tight end Vernon Davis didn't have a reception for the first time all season.
With the future of the 49ers on display, there were plenty of glimpses to the past - and five Super Bowl titles.
"There's a lot of history in this stadium," Bowman said. "For this to be the last game, we cannot leave it with an L. So I'm glad we got the W."
The 49ers are set to move into $1.2 billion Levi's Stadium at team headquarters in Santa Clara while Candlestick waits out its implosion day, likely in late 2014.
Atlanta went ahead 7-3 on Steven Jackson's 2-yard touchdown run. The score was set up by a 59-yard catch and run by Drew Davis and then a pair of penalties against safety Donte Whitner, a personal foul and unsportsmanlike conduct.
San Francisco's Carlos Rogers dropped a would-be interception during the Falcons' final drive of the first half that culminated in Matt Bryant's 35-yard field goal that put Atlanta ahead 10-3.
NOTES: Atlanta's 24 losses at Candlestick are the most of any 49ers opponent. ... The Falcons lost defensive tackle Corey Peters in the second quarter to an Achilles injury. Atlanta RB Jacquizz Rodgers suffered a concussion in the second half.