NEW YORK – If the New York Rangers’ new top line is going to produce like this, it might not make any difference if the rest of the offense is a bit unbalanced.

Marian Gaborik scored twice 2:13 apart in the first period and then completed his 14th NHL hat trick 27 seconds into overtime as the Rangers overcame a pair of blown leads and beat the Boston Bruins 4-3 on Wednesday night for their first win of the season. It was also Boston’s first loss.

Instant results from the trio of Gaborik, Rick Nash and center Brad Richards made it possible.

“Your best players need to be your best players,” Coach John Tortorella said of the unit that produced three goals and five points. “They had some dips, as our team did throughout the game, but Gabby came through big.”

Gaborik got the puck from Andrew Ference and then outraced him and Johnny Boychuk up ice. His first shot was blocked by goalie Tuukka Rask, but Gaborik batted the rebound out of the air to end the game and start a cascade of flying hats onto the ice to celebrate his fifth hat trick with the Rangers.

“I think Ference fumbled the puck,” Gaborik said. “I just tried to chip it in front of me and tried to get some speed.

“I tried to shoot it at the blocker, and got a fortunate bounce on the rebound.”

Taylor Pyatt also scored for the Rangers (1-2), who squandered leads of 2-0 and 3-2 en route to avenging a season-opening 3-1 loss at Boston on Saturday. Henrik Lundqvist made 26 saves.

Brad Marchand and Milan Lucic erased Boston’s 2-0 deficit in the second period, and Nathan Horton got the Bruins even again at 3 with 4:23 left in regulation.

It was Horton’s first goal in more than a year as he was sidelined by a concussion last January. The Bruins fell to 2-0-1 in their first road game of the season.

“At first we came out kind of sluggish,” Horton said. “We realized that and turned it up in the second.

“It was a matter of just keep working.”

Gaborik did just that. He scored his first three goals of the young season to help the Rangers pull off a much-needed win.

“It was a good game for us,” Tortorella said. “We’re still a pretty sloppy hockey team, and I think it’s going to be that way for a bit.”

After a poor first period, the Bruins controlled play early in the second and earned a power play 18 seconds in. Marchand cashed in with his second goal of the season at 1:05.

The Bruins got to Lundqvist again after the Rangers left Lucic alone in front of the crease. Defenseman Zdeno Chara found him with a pass, and Lucic fired a hard forehand in on Lundqvist that was blocked. The rebound came right back to Lucic, who smacked the puck in with a second swipe to tie it at 12:24.

Pyatt restored the Rangers’ lead 46 seconds later.

“We redeemed ourselves pretty well. It could have been worse,” said Bruins Coach Claude Julien. “The first 10 minutes is what obviously cost us the game. What I liked about our team is their resiliency to get back and start playing like the way we should have.”