WASHINGTON — Jordan Staal tied it in the third period, Brock McGinn scored in the second overtime and the Carolina Hurricanes stormed back to stun the Washington Capitals 4-3 in Game 7 on Wednesday night to eliminate the defending Stanley Cup champions.

McGinn dived to prevent a goal in the final minutes of regulation and then scored 11:05 into the second extra period, and Petr Mrazek made 34 saves to continue an upset-heavy first round of the NHL playoffs. Carolina had the first nine shots of the first OT and 11 of 15 total, with Coach Rod Brind’Amour’s group showing it had plenty left in the tank.

Carolina showed the same never-quit attitude that helped it end the NHL’s longest playoff drought after a decade, erasing a 3-1 deficit. Top-line forwards Sebastian Aho and Teuvo Teravainen beat surprisingly shaky Capitals goaltender Braden Holtby, who allowed four goals on 42 shots.

“Time and time again we’ve just manned up,” said Hurricanes captain Justin Williams, who had an assist on McGinn’s winner. “It would have been easy to fold up, especially against a team like that. … Our guys really fought.”

The Hurricanes lost Games 1 and 2 but fought back without concussed winger Andrei Svechnikov and injured winger Micheal Ferland. Washington’s elimination means all four division champions were knocked out in the first round for the first time in NHL history. Game 7 losses by Vegas and Washington on back-to-back nights eliminated the two teams from last year’s Cup finals.

In one of the strangest first rounds in recent history, the Hurricanes beating the Capitals doesn’t even rank at the top of unlikely outcomes after Columbus swept Presidents’ Trophy winning Tampa Bay and Colorado closed out the Western Conference’s top seed, Calgary, in five games. With all four wild-card teams winning, Carolina now faces former Capitals coach Barry Trotz and the New York Islanders in the second round, starting Friday in Brooklyn.

The Capitals appeared poised to move on after a lopsided Game 5 win, but they lost Game 6 and then could hold a two-goal lead in Game 7. The Hurricanes closed the gap in the second period, tied the score on Staal’s third goal of the series 2:56 into the third, forced overtime and celebrated on Washington’s home ice.

Williams, who has an NHL-record 15 points in Game 7s, and the Hurricanes celebrated their first series victory since 2009, while the Capitals lost in the first round for the first time since 2013. Despite goals by Andre Burakovsky, Tom Wilson and Evgeny Kuznetsov and a monster game from captain Alex Ovechkin, Washington fell to 4-8 in Game 7s during the Ovechkin era.

The Capitals joined the Predators and Penguins as teams that won at least one series each of the past three years but failed to get out of the first round in these playoffs. They were hurt by a season-ending torn left hamstring to defenseman Michal Kempny and a broken collarbone to winger T.J. Oshie, whose appearance in the final minutes of regulation fired up the crowd but wasn’t enough to spark an OT win.

SHARKS: Joe Thornton gathered his teammates at the bench as a bloodied Joe Pavelski was taken off the ice after being knocked out on a hit and implored them to avenge their captain’s injury by scoring three goals on the ensuing major penalty to erase a three-goal deficit.

The San Jose Sharks did Thornton one better and scored four, setting the stage for a remarkable comeback for a franchise known for far too many postseason collapses.

The Sharks erased a 3-1 series deficit, a three-goal hole in the third period and bounced back after allowing a tying goal in the final minute of regulation to beat the Vegas Golden Knights 5-4 in overtime in Game 7 of their first-round series Tuesday night, showing the resiliency that critics had said was too often lacking.

“The leadership is the best I’ve ever been around,” Coach Peter DeBoer said. “Joe goes down. Joe Thornton immediately is talking to the guys, `Let’s get three goals here on this power play.’ He actually said that and we got four. Very fortunate as a coach to be around people like that. You don’t have to say a lot. They’re driving the bus.”

That leadership core that has been maligned over the years has led the Sharks into the second round against Colorado, with Game 1 in San Jose on Friday night.

To get there, the Sharks completed the first comeback from 3-1 down in a series in franchise history with help from 58 saves from Martin Jones and the first double-overtime short-handed goal ever by Tomas Hertl to win Game 6 on the road.

That pales in comparison to what the Sharks had to overcome Tuesday when they trailed 3-0 with 10:47 to play and Pavelski was lying on the ice after a cross-check from Cody Eakin and bump from Paul Stastny led to an awkward fall. The referees called a major penalty.

The Sharks rallied around their fallen leader to become the second team in playoff history to score four times on one major power play to take the lead. Fans at the Shark Tank who have become conditioned to postseason failure went crazy.

Predictably for the Sharks, it still didn’t come easy as they allowed the tying goal to Jonathan Marchessault with 47 seconds to play in regulation before fourth-liner Barclay Goodrow provided the winner 18:19 into overtime, making San Jose just the second team ever to overcome a three-goal deficit in the third period to win a Game 7.

San Jose has the most playoff appearances in the league since GM Doug Wilson’s first season in 2003-04 and will be tied for the most playoff series played during that time when the second round starts. They have also won the third most series in that span.

But a Stanley Cup title remains elusive for the Sharks, who lost the Cup final to Pittsburgh three years ago, lost three other times in the conference finals and painfully blew a 3-0 series lead to Los Angeles in 2014.