Brandon Pirri had a goal and an assist while Scottie Upshall and Quinton Howden also lit the lamp for the Panthers, who came into the game having lost four of five.
San Jose is tied with Anaheim, which lost to Washington on Tuesday, for first place in the Pacific Division and will welcome the Ducks to SAP Center on Thursday.
The Sharks scored at 4:02 of the second on the power play to take a 1-0 lead as a Burns pass from the right wing hit off a defender, but went out to the slot and Havlat shot it home for his eighth of the season.
Florida tied the game at 11:23 of the second when Pirri's shot from the left wing hit Niemi and popped into the air, landing behind the goalie and hitting his left skate before going into the net.
Just 17 seconds later the Panthers made it a 2-1 game as Pirri's heavy shot from the right wing was stopped, but the rebound came out to the crease and Howden slammed it in for his third of the season.
The Panthers took a 3-1 lead into the second intermission as a turnover saw Joey Crabb send the puck from the left wing to the right where Upshall one- timed it home with 14.8 seconds left in the frame.
San Jose completely dominated play in the third period, sending a franchise- record 29 shots on Luongo in the frame.
Luongo, though, was up to the task as he helped his team kill off four minors, including 51 seconds of a 5-on-3, and stopped multiple chances on several occasions.
"Our power play really had a chance to do something there in the third period and we just couldn't capitalize," said San Jose captain Joe Thornton. "Luongo is a world-class goalie and he made some really big stops there."
The Sharks finally got one past Luongo to make it a one-goal game as a left circle faceoff saw the puck come down low and Burns swept it in with 3:03 to play.
San Jose pulled Niemi with over a minute to play for the extra attacker, but Luongo made several more stops, including a chance down low by Joe Pavelski, to give his team the win.