The Penguins were trailing 3-2 early in the final frame after surrendering three consecutive Buffalo goals, but notched the equalizer 7 minutes into the third on Pascal Dupuis' tally.
That set up the game-winner, in which Martin fired a rolling puck from above the left circle that Sabres goaltender Ryan Miller didn't see. It ended in the back of the net, handing the Penguins a third straight victory.
Dupuis finished with two goals and an assist while Sidney Crosby scored and provided a pair of helpers for Pittsburgh.
Marc-Andre Fluery turned aside 30-of-33 shots to earn the victory.
Miller made 31 saves in the loss.