The Sabres held a 2-1 lead advantage in the third when Brayden Schenn and Scott Hartnell scored less than 3 minutes apart for a 3-2 lead.
Then with time winding down, Matt Read got control of the puck at the left post and fed a pass to Lecavalier, who found the net from the bottom of the circle for the game-winner.
Mason made 16 saves as Philadelphia broke a two-game skid.
Cody Hodgson and Matt D'Agostini scored for Buffalo, which lost at home in regulation for the first time in nine games.
Jhonas Enroth stopped 29 shots.
Notable deaths of 2014 [PHOTOS]