After St. Louis pulled the Lightning even at 14:09, Palat made it 3-2 from the low slot 1:46 later.
Tyler Johnson had the other Tampa Bay goal as the Lightning completed a seven-game homestand with a 5-2 record.
Buffalo took a 2-1 lead when Vanek scored from the low left circle after taking a nifty pass from Marcus Foligno 12:46 into the third. Vanek has 24 goals and 39 points in 33 games against Tampa Bay.
Flynn tied it at 1-all with 7:02 left in the second when he scored off a pass through the crease by Cody McCormick.
Johnson put the Lightning up 1-0 on a rebound power-play goal at 12:48 of the first. The goal came after Sabres defenceman Tyler Myers failed to swat away the puck after Ryan Miller made a save on Valtteri Filppula's shot.
Buffalo has been outscored 16-1 during the first period this season.
Miller made several nice saves early in the second when Tampa Bay had two power plays. The goalie made a post-to-post save on St. Louis' right circle shot.
NOTES: Buffalo LW Ville Leino, activated before the game from injured reserve, had an assist. He missed 11 games due to a rib injury. ... The Sabres placed D Mike Weber on IR with an upper-body injury. ... Tampa Bay D Victor Hedman, who took a shot off his right foot in Thursday's win over Chicago, played.