Quinton Howden knocked in a rebound of Pirri's shot to cap a game-changing shift and Scottie Upshall added a goal in the closing minute of the second period for the Panthers, who had lost seven of their previous eight road games.
Marty Havlat and Brent Burns scored for San Jose and Antti Niemi made 21 saves. The Sharks missed a chance to move past Anaheim for first place in the Pacific Division. The teams are tied with 97 points heading into Thursday's showdown in San Jose but the Ducks have a game in hand.
The Sharks came into the game with the best home winning percentage in the NHL, but four of their nine losses at home have come against the bottom four teams in the inferior Eastern Conference — Carolina, the Islanders, Florida and Buffalo.
Luongo was a big reason for this win, making 28 saves in the third period when Florida was outshot 29-2 had to kill off four power plays, including 51 seconds of a two-man advantage.
San Jose had the extra skater for all but 27 seconds in a span of 7:36 during the middle of the period but couldn't get anything by Luongo.
Burns finally broke through on San Jose's 26th shot of the period when he knocked a puck past Luongo after a faceoff win by Joe Thornton with 3:03 remaining.
But Luongo robbed Joe Pavelski in the final minute to preserve the win.
San Jose has failed to score on 34 of its past 35 power plays at home since Feb. 3, with the only goal coming early in the second period when Havlat beat Luongo with a slap shot from the high slot.
But the Panthers took over the game after that and led 3-1 heading into the third. Pirri changed the tenor of the game on one shift. It started when he raced past Jason Demers and put a shot on goal that Niemi initially saved. But the puck popped in the air and landed behind Niemi, hit his skate and trickled into the net.
Just seconds later, Pirri got another shot on goal that trickled through Niemi and was sitting in the crease where Howden knocked it in for his third goal in four games this season.
The Sharks put on heavy pressure in the closing minutes of the period, but Luongo was up to the task and the Panthers added an insurance goal with 14.8 seconds to play when Pavelski lost the puck near the boards and Joey Crabb slid a pass to Upshall, who beat Niemi with a one-timer.
The game was scoreless after the first period with neither team generating many quality scoring chances. San Jose had an early power play negated when Pavelski tripped Brian Campbell. The Sharks then killed a late power play when Adam Burish was sent off for holding.
NOTES: F Jonathan Huberdeau (upper body) did not make the trip for the Panthers. ... Sam Tageson, a teenage hockey player with a life-threatening heart condition, practiced with the Sharks, skated through the shark head before the game and was introduced to a loud ovation before the game as part of a day arranged through the Make-A-Wish Foundation and the Sharks Foundation.