What seemed so impossible three weeks ago when the frustrated and despondent NHL team from St. Paul lost game after game, the Wild suddenly is back in the top eight in the Western Conference standings.

Behind a first-period hat trick so to speak by each member of the Wild’s so-called third line and another backdoor slam-dunk by red-hot Charlie Coyle, the Wild leapfrogged the Colorado Avalanche in the standings with a 6-3 victory Tuesday night at Xcel Energy Center.

Coyle’s goal 5 minutes, 34 seconds into the third period acted as the winner, then Coyle and Nino Niederreiter added empty-netters to stick a stake in the Avs and lift the Wild to consecutive home victories for the first time since Dec. 15 and 17.

On Feb. 13, the Wild lost for the 16th time in 19 games to fall five points out of a playoff spot and trigger Mike Yeo’s firing. The Wild is 6-3 since and now sits above the Avs, who also have 68 points but have played one more game.

“I’m happy for the guys,” interim coach John Torchetti said. “They’ve worked their butts off for it. We’ve got a long way to go still.”

In the first period, the Wild — and especially the red-hot Niederreiter-Erik Haula-Jason Pominville line — could do no wrong. Tasked with shutting down the Mikkel Boedker-Nathan MacKinnon-Gabriel Landeskog line, each Wild forward scored in the first 20 minutes.

Torchetti loves using this trio as a shutdown line because “they want to play on both sides of the puck. The whole team can learn from that.”

Niederreiter put the Avalanche on a power play 12 seconds into the game, and 21 seconds after that, Jarome Iginla — who feasts on the Wild — scored his 12th power-play goal of the season.

NHL Wild-Card standings

But the Wild, previously 3-18-6 when giving up the first goal of a game, got a great response and ultimately got goals from Pominville and Niederreiter 61 seconds apart.

Pominville created both with defensive-zone steals. Niederreiter scored off a 2-on-1 similar to his 2014 Game 7 series-clincher against Semyon Varlamov. Pominville scored his fifth goal in eight games off a breakaway after Niederreiter’s patient pass as Pominville sprinted up the gut.

Finally, late in the period, Haula scored a breakaway goal after Matt Dumba’s headman pass hit the speedster in stride.

“We know [Colorado’s] weakness is definitely defensively, and that’s what we [had] to take advantage of,” Niederreiter said.

Avs coach Patrick Roy replaced Varlamov with Calvin Pickard to start the second, and the change had the desired effect: a tie score entering the third after Chris Bigras’ first NHL goal and Cody McLeod’s tying goal.

The momentum turned after Dumba broke his stick leading to a Colorado rush up ice. Haula tried to give his stick to Dumba by throwing it like a javelin. Not only is that a penalty, Dumba didn’t catch Haula’s stick, so the Wild suddenly had two defenders with no sticks. The Avalanche scored on the delayed penalty.

Haula said after the game he didn’t know the rule: “Yeah, I won’t do that again.”

Early in the third though, Mikko Koivu forced a turnover and Zach Parise flew by Bigras before feeding a driving Coyle for the pretty tap-in. Coyle’s empty-netter was his 11th goal in the past 18 games and team-leading 21st.

“Enough can’t be said about Zach and Mikko and just me being at the end of it,” Coyle said of his run. “I mean, I get the goal. But those guys do the work, they make the plays.”

The Wild now heads to Toronto and Buffalo, where it hopes newly acquired winger David Jones can debut after getting a U.S. work visa.

The Wild also hopes to get defenseman Jonas Brodin and winger Jason Zucker back from injuries, something Torchetti joked would be like his trade deadline pickup.

“We’ve got 18 games now to control our own destiny, and that’s a spot we’re happy to be in,” goalie Devan Dubnyk said.