SANTA CLARA (AP) Matt Ryan teamed up with Julio Jones on a 5-yard pass that was ruled a touchdown after a replay reversal with 2 seconds left, sending the Atlanta Falcons past the playoff-bound San Francisco 49ers 29-22 on Sunday.
Jones was called short of the goal line with the Falcons trailing 22-17. But a replay showed the ball breaking the plane with the Jones in the air while being tackled by Jimmie Ward.
When things couldn't get crazier, they did: On the final kickoff, Atlanta scored another touchdown when Olamide Zaccheaus came up with the ball as the 49ers were tossing it around in desperation.
The 49ers still clinched their first playoff berth since a 2013 run to the NFC championship game with the Rams' loss at Dallas.
In an afternoon when Jimmy Garoppolo and the offense hardly shined, San Francisco's other units did their best to hold off Ryan until the quarterback exhibited the poise of a former MVP in a dramatic final minute _ or, make that 12 seconds.
Kyle Juszczyk recovered a fumble on the punt return team early in the fourth quarter then caught a 2-yard touchdown pass from Garoppolo two plays later as the 49ers (11-3) briefly gave themselves some room before failing to close it out.
Fill-in safety Marcell Harris broke up a pass in the end zone intended for Austin Hooper in the waning moments. Then with 8 seconds remaining, Hooper couldn't keep hold of the ball in the end zone though the Falcons were already celebrating an upset when the play went to a review and the catch overturned because the ball hit the ground.
They got one more chance, and made it count. Then Atlanta celebrated for real, leaving San Francisco's players stunned.
Before Juszczyk's timely pounce, it appeared there was no way Ryan would get the best of Kyle Shanahan and San Francisco just a week after the Niners put up 48 points in New Orleans.
The Falcons (5-9) got within 19-17 on Qadree Ollison's 1-yard touchdown run early in the fourth.
Garoppolo was 22 for 34 for 200 yards and had 13 completions to George Kittle for 134 yards. Garoppolo's streak with a passer rating of at least 110 ended at four straight games when he finished at 90.3. The only San Francisco QB to do that previously was Steve Young with six-game streak in 1994.
Facing his former team and now in his third year as 49ers coach, Shanahan's high-powered offense fizzled much of the day.
Shanahan spent two seasons as offensive coordinator in Atlanta coaching Ryan during his 2016 MVP year when the Falcons set a franchise record by scoring 540 points and Ryan had career bests in yards passing (4,944), TD passes (38) and passer rating (117.1). Then the Falcons blew a 28-3 lead on New England in the Super Bowl and Shanhan left for the Bay Area shortly after.
Out West, Shanahan and Garoppolo hope for their own special playoff run with a different result.
Ryan threw a 5-yard touchdown pass to Jones midway through the second quarter and the Falcons led 10-7 on Younghoe Koo's 43-yard field goal late in the quarter before the Niners tied it with a 22-yard field goal by Robbie Gould.