Tage Thompson had a goal and an assist for Buffalo (8-9-4), which lost its fifth straight game (0-4-1). Mattias Samuelsson and Jiri Kulich scored, and Alex Lyon made 29 saves.
The Sabres outshot the Flyers 8-6 in the first period but managed just 11 shots on goal the rest of the game.
"I thought our puck play got really careless," Buffalo coach Lindy Ruff said. "Didn't get pucks in deep start of the second period, we turned over too many pucks. I thought our puck battles in the first were excellent. I thought our puck battles, starting in the second, we went by some plays, lost puck battles, and we gave them opportunities."
Dvorak put the Flyers ahead 4-3 at 5:23 of the third period. Nick Seeler found him with a long pass out of the defensive zone at the Buffalo blue line, he skated down the left side of the zone and scored to the far side from the left circle.
"'Seels' made a great play with the quick up, and I was all alone there," Dvorak said. "That was just a great play by Seels."
Sanheim had put the Flyers ahead 3-2 29 seconds into the third period. With the teams skating 4-on-4, Sanheim pinched down into the left face-off circle and one-timed a seam pass from Dvorak.
The play began with Flyers forward Denver Barkey intercepting a clearing attempt at the top of the Sabres zone, a play Ruff felt was avoidable.
"We should have just kept possession 4-on-4," he said. "We made a decision to put it in the middle of the ice and it cost us dearly."