Miller had a 2-0 lead and was working on a shutout until the Maple Leafs pulled goalie Ben Scrivens with more than 2 minutes remaining to add an extra attacker.
The strategy paid off when Mike Kostka's shot hit the wall behind the goal and rebounded right to Nazem Kadri, who put the bouncing puck past Miller into the top of the net.
The Leafs had two more chances to tie it up, but Phil Kessel's shot was high and Miller made another save during a scramble in front of the net as the buzzer sounded, preserving Buffalo's second straight win to start the season.
Jason Pominville notched a goal and an assist and Cody Hodgson also tallied for the winners.
Scrivens made 18 stops for Toronto, which fell to 1-1-0.
Swim Week Miami Beach 2014 [PHOTOS]