– The Wild had no problem rallying from being down two goals earlier in the week, and it nearly one-upped that feat by clawing back from an even deeper deficit its next time out.

On the heels of its most impressive comeback win of the season Tuesday in Anaheim at the outset of a four-game road trip, the Wild tested its resiliency again Thursday in San Jose after falling behind by four in the first period.

And although the Wild eventually made up those goals, it never completely caught up to the Sharks in a 6-5 letdown Thursday night at SAP Center that was pockmarked by a string of what-if moments.

“We knew we could come back,” winger Luke Kunin said. “You saw that. We did a lot of good things and it was too little, too late.”

VideoVideo (01:05): Coach Bruce Boudreau recaps the 6-5 loss to the Sharks Thursday.

Despite the Wild (5-10-1 overall, 2-9 on the road) getting scored on four times in the opening period and giving up two more in the second, coach Bruce Boudreau thought his team had a chance to close the gap going into the third trailing just 6-2.

“This isn’t over,” he told the players at the intermission, and they backed up his intuition.

One-timers from defenseman Brad Hunt 8 minutes, 7 seconds into the frame and winger Ryan Donato at 9:21 — his first of the season — moved the Wild within striking distance of the Sharks at 6-4.

But that rhythm hit a snag when winger Ryan Hartman was reprimanded with a slashing major and misconduct for a one-handed whack to the back of Evander Kane’s left leg.

Kane was also penalized for the cross-check that preceded Hartman’s slash, but defenseman Brent Burns wasn’t after he tussled with Hartman. So the Sharks were set up to earn three minutes of power play action, which arrived sooner when the Wild was called for a too-many men penalty while play was at 4-on-4.

“Kane did a great job of selling it because he went off limping,” Boudreau said. “Everyone thought he had a broken ankle, and he missed one shift. So you go figure it out. But that’s a good job by him to change the momentum.”

Those lost minutes to the penalty kill were costly because when it was back at full strength, the Wild picked up where it left off before the slashing sequence. Winger Jason Zucker tallied a fifth at 15:25, the closest the Wild would get even though it continued to earn glorious opportunities.

Winger Zach Parise skated in alone on goalie Martin Jones, who spread out his pads to make the stop with less than 3 minutes to go. And defenseman Ryan Suter hit the post in the waning seconds.

“We had plenty of chances to tie the game,” center Eric Staal said.

The Wild was in chase mode most of the game because of its horrendous start, a jarring drop-off after it closed out the 4-2 victory over the Ducks Tuesday.

Only 52 seconds into the first, the Sharks pounced when captain Logan Couture buried a Kane pass by goalie Alex Stalock.

By 5:55, it was 2-0 — a wrist shot by Timo Meier after he accepted a Tomas Hertl backhander and cut into the Wild zone with speed.

A breakaway save by Stalock on Kane and Wild power play later in the first seemed to even up the feel of the game, but two more Sharks goals in 1:52 reasserted San Jose’s control.

Marcus Sorensen’s deflection made it 3-0 at 16:40, and a 4-on-2 rush tacked on a fourth after a give-and-go passing sequence by Hertl and Meier handed off to Radim Simek for the finish at 18:32.

Overall, the Sharks totaled four goals on 12 shots. It was the fourth game this season the Wild has surrendered four or more in a period but just the first time it’s happened in the first.

Stalock, who made his second straight start after posting 29 stops in that victory against the Ducks, was replaced by Devan Dubnyk after the period. He exited with eight saves.

“You never want to not finish a game,” Stalock said. “Like I always say, you want to give your team a chance and it’s 4-0 after the first period. That’s obviously not giving them a chance.”

The Wild also was shorthanded the rest of the way, as winger Marcus Foligno didn’t return for the second due to a lower-body injury.

With 4:09 to go in that period, the Wild finally cut into its deficit on a shot by winger Luke Kunin.

The Sharks reinstated their four-goal lead on a wrister by Hertl at 17:04 on the power play but just 55 seconds later, Staal capitalized on a redirect to extend his point streak to six games — a span in which he has nine points. In his past nine games, Staal has recorded six goals and seven assists.

Yet again, though, San Jose had a retort.

This time, Kane served up another power play tally at 19:15 while winger Jordan Greenway was in the penalty box for a delay of game minor after sending the puck over the glass.

The Sharks finished 2-for-4 with the man advantage, while the Wild went 0-for-3.

Dubnyk ended up with 17 saves. Jones totaled 21 for the Sharks.

“After the first period,” Boudreau said, “we deserved [a] better fate.”