Daniel Briere and Jason Pominville also scored twice for the Sabres, who have won four of their past five following a four-game losing streak.
Boyd Devereaux had two goals, Matt Stajan had a goal and an assist and Bryan McCabe also scored for the Maple Leafs, who lost for the third time in four games.
Toronto failed to move up in the Eastern Conference race and remains in 11th place, two points behind Carolina for the eighth and final playoff spot.
The win gave Buffalo 103 points, breaking a tie with Nashville for the top spot in the league.
Buffalo goalie Ryan Miller finished with 40 saves.
After Devereaux gave Toronto a 4-1 lead 3:52 into the third, the Sabres stormed back, with Vanek starting the rally with his team-leading 37th at 5:27 to make it 4-2.
Briere made it 4-3 with his 31st at 9:18, and Pominville tied it with 6:08 remaining, beating goalie Andrew Raycroft with a wrist shot on a partial breakaway.
Twenty seconds later, Stafford put Buffalo ahead 5-4, re-directing Vanek's pass in front of Raycroft.
Toronto defenceman Tomas Kaberle made his return after missing eight games with a concussion. Kaberle hasn't played since being checked into the boards on a late hit by New Jersey's Cam Janssen on March 2. He assisted on McCabe's goal.
Vanek opened the scoring 5:17 in with Buffalo on the power play. Standing in front of the net, Vanek deflected defenceman Dmitri Kalinin's shot from the middle of the blue-line past Raycroft.
McCabe tied it on a two-man advantage with 65 seconds left in the first on a slap shot from the top of the right circle.
The Sabres allowed a season-high 21 shots in the first period, but Miller kept them in the game with several sparkling saves, including a stop on Stajan's breakaway with five minutes left.
Stajan gave Toronto its first lead 4:11 into the second. Just a couple of feet in front of Miller, Stajan re-directed Alex Steen's pass from the bottom edge of the right circle.
Devereaux pushed Toronto's lead to 3-1 with a goal 59 seconds into the third.
Raycroft finished with 29 saves.
Notes: The teams will meet for the final time this season on Saturday in Toronto. ... Buffalo D Toni Lydman missed his fourth game because of an upper-body injury. ... Toronto D Hal Gill played in his 700th career NHL game. ... The Maple Leafs were 4-3-1 without Kaberle, the team's third-leading scorer. ... Toronto has lost four straight on the road. ... Following Devereaux's second goal, Miller threw his stick in disgust.