The Miami Dolphins led for 50 minutes. They finally got some big plays from Mike Wallace. They played perhaps their best defensive game of the season.
And with 2 1/2 minutes left, the Dolphins needed only a defensive stop on fourth-and-10 to seal a victory over Carolina.
But they couldn't close it out. Cam Newton's 19-yard completion gave the Panthers a first down, and they drove 80 yards for the winning touchdown in the final minute to beat Miami 20-16.
The fourth-down conversion was a backbreaker.
''I'm not sure there's any other word to describe that,'' defensive lineman Jared Odrick said.
''That's when the tide shifted in our favor,'' Newton said.
The Dolphins (5-6) fell to 2-2 since tackle Jonathan Martin left the team and Miami's bullying scandal began to mushroom. After taking a 16-3 lead, they were shut out in the second half.
''We've got to make plays at the end when it counts,'' Wallace said. ''We've got to have a killer instinct. I don't think we have it that well right now. We've got to do a better job of putting teams away.''
The Panthers (8-3) extended their winning streak to seven games, their longest since 2003.
The Panthers trailed 16-13 when their winning drive began at their own 20 with 4:13 remaining. Down to one timeout, they went for it on fourth down, and Newton threaded a pass between two defenders to Steve Smith for a 19-yard gain.
Carolina then converted two third downs before Newton hit Greg Olsen on a 1-yard pass for the winning score with 43 seconds left.
Ryan Tannehill nearly connected with Wallace for a 60-yard score in the final seconds, but the pass fell incomplete at the goal line.
''That's a tough play,'' Tannehill said. ''You're basically a hope and a prayer and get it out there.''
''A little scary,'' Carolina coach Ron Rivera said.
Tannehill, who had repeatedly underthrown the speedy Wallace this season, was told this week by coach Joe Philbin to ''let it rip'' and did so in the first half, twice hitting the Dolphins' $60 million receiver deep. They connected for a 53-yard touchdown and a 57-yard completion to set up a field goal.
Tannehill also overthrew an open Wallace deep in the third quarter.
Newton's interception led to another Miami field goal, and he finished with a quarterback rating of only 60.6. But he was at his best with time running out.
Following the Panthers' uncharacteristically slow start, he led them 52 yards for a field goal in the final 61 seconds of the first half with no timeouts left, taking advantage of Miami's soft coverage to cut the deficit to 16-6.
Rivera's willingness to take chances paid off in the third quarter. From the Panthers 41, Newton ran for 8 yards to convert a fourth-and-1, and they went on to complete an 83-yard touchdown drive to make the score 16-13.
''They have been calling our coach Riverboat Ron because he likes to gamble,'' Newton said.
For the second game in a row, the Panthers' Luke Kuechly made a big play in the end zone that was disputed. He appeared to make helmet-to-helmet contact when he broke up a potential touchdown catch by Rishard Matthews, and an official threw a flag, but the referee determined there was no penalty and Miami settled for a field goal and a 16-3 lead.
Kuechly bear-hugged the Patriots' Rob Gronkowski on the final play of the Panthers' victory at New England last Monday.
While Tannehill threw for 280 yards, he was also sacked three times to increase his season total to 44, a franchise record. Carolina held Miami's running backs to 16 yards in 13 carries and shut out the Dolphins over the final 31 minutes.
''We were lazy in the first half,'' Carolina's Smith said. ''We underestimated that team.''
The Dolphins fell to 4-4 in games decided by four points or less.
''We were a couple of plays away from winning,'' Tannehill said. ''We've got to be able to make those plays. It's tough to win three-point games every week. When the defense is playing well like that, we've got to be able to score more points.''
NOTES: Miami RB Daniel Thomas left the game in the third quarter with a left ankle injury. ... The Panthers had been 0-4 against Miami. ... Ted Ginn Jr. dropped a potential 50-yard catch playing in Miami for the first time since he left the Dolphins as a first-round bust following the 2009 season. ... The Dolphins announced their annual cycling event has raised $3.1 million for the University of Miami Sylvester Comprehensive Cancer Center.
AP NFL website: www.pro32.ap.org and http://twitter.com/AP-NFL
Follow Steven Wine on Twitter: http://twitter.com/Steve-Wine