NEW YORK (AP) -- In a series of terrible losses, the Tampa Bay Lightning were in line for the worst of them all.
A three-goal lead was all but gone in the third period and the Lightning took one inexplicable penalty after another, almost daring the struggling New York Rangers to take this win away.
Karri Ramo didn't let it happen.
Ramo bounced back from an early mistake and made 31 saves, including 12 in the third, to lift the Lightning to a 5-3 win over New York on Tuesday night that snapped a seven-game losing streak.
"Ramo was spectacular," Lightning coach John Tortorella said. "We found a win but we have so much work to do as far as understanding situations and having some common sense."
The Lightning had gone 0-5-2 following a win over Toronto on Dec. 20 that ended a 1-4-1 skid. Tampa Bay is last in the Eastern Conference with 37 points, and only Los Angeles has fewer in the NHL.
The checking forward broke out of a season-long slump with two goals and an assist for the Lightning, who were desperate for a win at the end of a four-game road trip (1-1-2). The trio of Gratton and former Rangers Jan Hlavac and Jason Ward chipped in two goals and three assists.
"Any way that we can help take the pressure off because our big line has carried us all year," Gratton said.
Defenseman Doug Janik and Prospal also scored for the Lightning, who led 4-1 late in the second period. St. Louis added an empty-net goal with 2.4 seconds left, off an assist from Lecavalier.
"We got some play out of people that we need to get play out of more consistently. That was important," Tortorella said. "We were good a lot during the trip, we were lousy a lot during the trip, we were awful a lot during the trip and we were really good during the trip."
Ramo was a key reason why they earned four of eight points. He got help in the third when one shot caught a post and another trickled wide after he got a piece with his glove.
"It's just a matter of inches. I was kind of lucky," he said.
The Rangers showed life after returning home from an 0-2-1 trip to western Canada but couldn't finish the rally. Jaromir Jagr gave them a 1-0 lead in the first period, and Scott Gomez and Michal Rozsival scored power-play goals to get them closer.
The Lightning weren't called for any penalties until Ward went off for slashing with 2:47 left in the second.
The Rangers took advantage just over a minute later when Rozsival faked a shot but found Gomez for an easy tip-in to make it 4-2 at 18:24.
New York's comeback continued in the third when Craig MacDonald was given a four-minute penalty for high-sticking defenseman Fedor Tyutin. Rozsival scored his career-high 11th goal 43 seconds into the power play, cutting the deficit to 4-3.
Still, the Lightning, who failed to protect a 3-1 lead in a 4-3 overtime loss at Ottawa on Saturday, tried to bring the Rangers back in it.
Gratton went off for tripping, and Tampa Bay turned it into a two-man advantage that lasted 1:24 when they had too many men on the ice. The Lightning killed it despite several hard drives by Brendan Shanahan.
The Rangers got another power play with 3:30 remaining when Ward shot the puck into the seats.
"In the third we all truly believed, we just came up short," Gomez said.
Gratton has been a Rangers killer throughout his 14 seasons. In 53 games, the 32-year-old Gratton has 15 goals and 42 points.
Gratton had zero points in the Lightning's previous 12 games, including three in which he was scratched. After posting three goals and an assist in his first six games this season, Gratton had one goal and five assists in his next 33 before Tuesday.
The Rangers got off to a good start with help from Ramo, who gave them the kind of break they missed during their nearly pointless trip.
Ramo went behind his net to play a dump-in, and when he tried to clear the puck he shot it into Marcel Hossa near the right post. Jagr got his stick on it and pushed the puck into the net at 3:02 of the first period.
Gratton earned the secondary assist on Janik's first of the season that tied it at 5:50.
Gratton then finished a play at 8:24 off a feed from Ward. Gratton struck again 4:23 into the second period to make it 4-1.
"Everybody knows we should have won and we have to win," said Henrik Lundqvist, who made 21 saves. "Somebody asked if it was a wake-up call. That wake-up call came a week or two weeks ago."
The Rangers were without left wingers Martin Straka (concussion) and Sean Avery (bruised hand). Shanahan played despite a bruised left knee. ... Lecavalier, the NHL scoring leader, was voted to the All-Star starting lineup for the first time.