CALGARY --Josh Bailey scored with 17.8 seconds left in overtime to give the New York Islanders a 2-1 win against the Calgary Flames at Scotiabank Saddledome on Thursday.

Defenseman Thomas Hickey scored midway through the third period, and Jaroslav Halak made 31 saves for the Islanders (33-19-7), who are 3-0-0 on a season-long seven-game road trip that continues Sunday against the Edmonton Oilers. The win gives New York a five-point lead over the Pittsburgh Penguins for third place in the Metropolitan Division.

"It's important to get these OT [wins] down the stretch," Bailey said. "You never know what kind of position you'll be in come playoff time. It was nice to get the win and find a way in the third."

Jiri Hudler scored for the Flames (26-30-4), who have lost three straight and six of seven. Calgary remains 14 points behind the San Jose Sharks for third in the Pacific Division and 12 points behind the Colorado Avalanche for the second wild card into the Stanley Cup Playoffs from the Western Conference.

"I thought we fought real hard," Flames coach Bob Hartley said. "There was great intensity throughout the entire game. It started with a body check and then the emotions were running high and it brought the best out of both teams. From the bench, it was a fast-paced hockey game."

John Tavares spun away from Johnny Gaudreau in Calgary's zone before skating into the right circle and finding Bailey with a pass across the top of the crease. Bailey lifted a shot over Flames goaltender Joni Ortio for the game-winner.

"It was a great play," Bailey said. "I think I was just trying to get backdoor. I knew he'd find a way to get it over. I wasn't even sure it went in at first. I was judging off his reaction. It definitely felt good and it was a big win for our team."

Bailey's goal came after Flames captain Mark Giordano hit the post with 1:07 remaining.

"We had chances," Hartley said. "You get into OT and it can go either way. [Giordano] hits the post and they came back and scored the winning goal."

Hudler scored on Calgary's second shot of the game, completing a nice passing play with linemates Gaudreau and Sean Monahan. A pinch by Giordano kept the puck in New York's zone, and Gaudreau dropped a pass to Monahan, who found Hudler with a cross-slot pass. Hudler paused before lifting his 10th goal of the season over Halak to give Calgary a 1-0 lead at 4:16.

Gaudreau has assists in six straight games.

Halak kept the Islanders in the game with 11 saves in the second period. He stopped Monahan's slap shot from the high slot after Gaudreau's stickhandling work at the top of the blue line at 13:11, then made back-to-back pad saves on Micheal Ferland and Sam Bennett from the slot a shift later.

"Jaro was really good," Hickey said. "That wasn't a pretty game. I don't think we'll sugarcoat it. You're not where you want to be after 40 minutes and you're down one goal because your goalie plays well. We just said 'Hey, let's play 20 [minutes] and see what happens.' Those are the games you need to win if you're going to be a playoff team. It's not pretty, but those are the ones that count."

Halak denied Hudler on the doorstep 1:24 into the third after another three-way passing play with Gaudreau and Monahan.

The Islanders tied the game at 9:49 when Matt Martin evaded checks from Giordano and Monahan in the Calgary zone and fed Hickey in the slot. The defenseman's backhand shot rolled up and over Ortio for his third goal of the season.

"[Martin] made a really nice play curling up, a patient play," said Hickey, who hadn't scored since Oct. 23, a span of 36 games. "I got it and my first thought was to shoot. I couldn't shoot on my forehand, so I just put it on my backhand. Sometimes you're better off just throwing it on net rather than picking a corner, and it trickled its way through there. It was a nice feeling."

The goal meant a little extra to Hickey, who grew up in Calgary.

"I watched a lot of games in this rink and saw a lot of goals," he said. "You hope that's you some day. You don't think about scoring on the Flames growing up, but it's a real cool moment for me and my family and my friends too."

The Flames end a two-game homestand against the Ottawa Senators on Saturday before a four-game road trip against Eastern Conference opponents.