The Sabres, owners of the worst record in the NHL, have won consecutive games for the first time in more than a month.
Boston overcame an early 1-0 deficit with a pair of goals from Brad Marchand in the second period, but Marcus Foligno deflected a shot past Chad Johnson with 2:49 left in the middle stanza to create a 2-2 tie.
Stafford's game-winning goal came with 5:41 left in the third and Tyler Myers delivered an insurance score on a slap shot with 4:21 to go.
It was the ninth win of the season for the Sabres, who had not won back-to-back games since Nov. 12-15. Boston has dropped two straight after winning four in a row.
Ryan Miller made 34 saves to get the win. Johnson surrendered four goals on 23 shots.