The victory enabled the Sabres to win their first Northeast Division crown in three years.
Jason Pominville's cross-ice pass to Hecht set up the go-ahead goal at 5:17 of the second period. Hecht took the pass and wristed a shot from the right circle past Rangers goalie Henrik Lundqvist for a 3-2 lead.
Lundqvist was pulled after allowing three goals on 16 shots as the Rangers' playoff hopes took a blow. New York fell three points behind Boston for the last playoff spot in the Eastern Conference.
Brandon Prust and PA Parenteau got the Rangers' tallies.