The Maple Leafs overcame a 2-0 deficit with three second-period goals, but the Sabres forced overtime when Steve Ott scored on the power play with 25 seconds to go in regulation.
Toronto then won for the first time in three games when Lupul beat Ryan Miller to begin the second round of the shootout.
Jonathan Bernier stopped 32 shots in regulation and overtime before turning in a perfect shootout to collect the win.
Toronto's second-period goals came from Jake Gardiner, Peter Holland and Phil Kessel.
Miller made 39 saves as the Sabres failed to build on a streak in which they had won three of four. Buffalo's 10 wins this year are the fewest in the NHL.
Swim Week Miami Beach 2014 [PHOTOS]