ARLINGTON, Texas (AP) — One gamble after another failed for coach Mike McCarthy in his home debut with the Dallas Cowboys.

A successful onside kick made them all moot.

Greg Zuerlein kicked a 46-yard field goal as time expired, and the Cowboys overcame four fumbles and a 20-point deficit in the first quarter to beat the Atlanta Falcons 40-39 on Sunday.

The Falcons were still up 15 in the fourth quarter before Dak Prescott became the first quarterback in NFL history to pass for more than 400 yards and rush for three touchdowns in the same game, the third TD getting Dallas (1-1) within two.

Zuerlein did not use a tee for his slow-rolling onside attempt, a rare tactic. But even more curious was Atlanta's players surrounding the ball when they could have recovered it. As soon as it crossed the 10-yard mark, C.J. Goodwin pounced — and later emerged from the big pile with the ball and 1:48 on the clock.

Rookie receiver CeeDee Lamb's 24-yard catch got the Cowboys in field goal position, and they ran down the clock before “Greg the Leg” touched off a wild celebration for the players and the socially distanced 21,708 fans who booed Dallas off the field with Atlanta up 29-10 at halftime. The crowd was 27% of AT&T Stadium's 80,000-seat capacity.

“I don’t know if I’ve been in many games like this thing,” Prescott said. “But to be able to get the win, and in front of those fans that were there, stayed the whole game, they didn’t give up on us. That was a huge difference.”

Instead of lamenting just his second 0-2 start — his only one was his first season in Green Bay in 2006 — McCarthy celebrated his debut on the Dallas sideline of the venue that hosted his Super Bowl win with the Packers a decade ago.

In his final two appearances in the $1.2 billion retractable-roof stadium with the Packers, McCarthy watched as Aaron Rodgers beat the Cowboys twice in the final seconds, including a divisional playoff game when Prescott was a rookie.

“I had one on the other sideline, but not like this,” McCarthy said. “We dug ourselves such a big hole in the first quarter. We’re early in the process of our football team finding out about each other each and every day.”

Matt Ryan threw four touchdown passes, two off the three lost fumbles from the Cowboys in the first quarter, which ended with Atlanta in front 20-0.

But the Falcons couldn't avoid their first 0-2 start in six seasons under coach Dan Quinn in a performance reminiscent of their blown 28-3 lead in a Super Bowl loss to New England in Houston to finish the 2016 season.

In the past nine seasons, Atlanta now has two of the three instances in which a team lost after leading by at least 15 points with less than eight minutes remaining in the fourth quarter.

“It’s tough to put a loss like that in place,” Quinn said. “I told the team there has to be a lesson in the pain of that loss. We’ll work into that as we put in preparation for next week, but definitely that one stings.”

The successful onside kick for Dallas came after two failed fake punts and another gamble that didn't work when McCarthy went for the 2-point conversion before the final touchdown the Cowboys would have needed to get even.

Playing without both of his starting tackles, Prescott was 34 of 47 for 450 yards and a touchdown with one sack. It was his first game with multiple rushing TDs. The two-time Pro Bowler is the franchise leader for rushing scores from a QB.

Prescott's first two TDs got Dallas within five in the third quarter. Ryan responded by converting a third down with a 22-yard pass to Hayden Hurst, who had a 42-yard touchdown on another first-quarter blunder from Dallas, a blown coverage.

After a 19-yard completion to Julio Jones on fourth-and-2, Russell Gage scored on an 8-yard throw for a 36-24 lead. Ryan had 273 yards passing a week after getting 450, second-most of his career.

The Falcons pushed the lead to 39-24 on Younghoe Koo's fourth field goal with just under eight minutes left.

“We’re definitely a better finishing team than we showed today,” Jones said. “We’re still positive, a very positive team. We’re not going to let it define who we are, we’ve just got to keep getting better.”

ANTHEM CONFUSION

Dontari Poe was again the only Dallas player to kneel for the national anthem, a week after the defensive tackle became the first on owner Jerry Jones' team to kneel. Jones has been among the most outspoken against players kneeling to protest social injustice and police brutality.

There was confusion over who was kneeling because several players from both teams were unaware “The Star-Spangled Banner” had started. That included several Dallas players kneeling in the end zone as part of their pregame routine.

During most of the anthem and when it was over, Poe was the only player for either team kneeling. Safety Donovan Wilson and linebacker Justin March had a hand on each shoulder, a show of support similar to what Poe received when he knelt before the opener at the Los Angeles Rams last weekend.

PROLIFIC RECEIVERS

A week after Atlanta had three 100-yard receivers in a game for the first time in franchise history, Dallas was the one with multiple 100-yard days. Lamb had six catches for 106 yards, and Amari Cooper had six for 100. Cooper's longest was a 58-yarder when he reached out with his right hand to stop the ball before gathering it in with both arms.

Calvin Ridley was the leader for the Falcons this week with 109 yards and two touchdowns. Gage had 46 yards and a score, while Jones was held to two catches for 24 yards.

INJURIES

Falcons RT Kaleb McGary injured his left knee in the first quarter and didn't return. Atlanta also lost linebacker Foeysade Oluokun to cramps and safety Ricardo Allen to an elbow injury.

UP NEXT

Falcons: Chicago at home next Sunday.

Cowboys: At Seattle next Sunday.

___

More AP NFL: https://apnews.com/NFL and https://twitter.com/AP_NFL

Copyright 2020 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed without permission.