NEW YORK — The Flyers tried the Great Claude Giroux Experiment at Madison Square Garden in Monday night's exhibition game, but it was overshadowed by rookie defenseman Travis Sanheim's surge to earn a roster spot.

Sanheim continued his strong all-around play and scored a pair of goals in the Flyers' 3-2 preseason loss to the New York Rangers. Ryan McDonagh scored the winner on a rebound with 1 minute, 9 seconds left in overtime.

"I'm just trying to play my game," said Sanheim, 21, who leads the Flyers with three goals in the preseason. "All along, I play that offensive side. I'm just trying to keep it simple defensively and trying to make smart plays and good reads and it's been working so far."

Selected in the first round of the 2014 draft  (17th overall), Sanheim has had an impressive camp along with fellow rookies Robert Hagg and Sam Morin. It has been assumed that only two will make the team, but their strong showings are making it difficult for general manager Ron Hextall to send one of them to the AHL's Phantoms.

If all three earned roster spots — Sanheim has gone from a dark horse to the leading candidate — Andrew MacDonald or Brandon Manning could go to Lehigh Valley.

Sanheim said his confidence is growing each day in camp. "Obviously, I don't want to get too high," he said. "I just have to try to keep an even keel and finish up strong" in the last three preseason games.

The 6-foot-3, 205-pound Sanheim took a feed from Nolan Patrick and, from the top of the left circle, blasted a shot over the glove of Henrik Lundqvist with 14 minutes, 21 seconds left in the first period to tie the game at 1-all.

The Manitoba native gave the Flyers a 2-1 lead as he pounced on a rebound of Radko Gudas' shot and scored on a backhander with 3.1 seconds left in the second.

"I knew time was running out, so I tried to jump low to create a chance late in the play," he said.

Giroux, a shifty center who has been one of the NHL's leading scorers the last seven seasons, played left wing on a line with center Sean Couturier and Jake Voracek.

The line started out slowly but gained some continuity and created some good scoring chances throughout the game. On the first one, Voracek set up Giroux on a two-on-one down low, but the Flyers' captain fired wide late in the opening period.

"It's definitely a change, but I'm just trying to be in good position and make the right play," said Giroux, whose team got strong goaltending from Michal Neuvirth. "Slowly, I'm feeling more comfortable there."

The Flyers hope moving Giroux — an ineffective five-on-five player last season — to Couturier's line will improve their even-strength play. Couturier is a better defensive player than Giroux, who will have more freedom on offense if the Flyers use the unit in the regular season.

Couturier has been Voracek's linemate in the past but has never been on a regular line with Giroux. "We've had an odd shift together here and there late in the period where we needed a faceoff or something," Couturier said before the game. "I'm happy to get that opportunity with him. We seem to always create something out of nothing the little time we've been together, so hopefully we can make it work."

Voracek and Giroux "can bring a lot to my game, and I think I can bring something to that line," Couturier said.

Couturier is lefthanded and Giroux is righthanded, so "you get the puck at different times" because of the way they have to maneuver for space, Voracek said. "Both guys bring different elements. 'G' is one of the smartest players in the league, and 'Coots' is always in the right position, so I don't think I really have to adjust my game. I can play my game and I know the puck is going to come to my stick."

The Flyers have three preseason games left before they start the season Oct. 4 in San Jose.

By then, they will have figured out the Giroux experiment and the defensive logjam.