The Sabres, who began the night five points out of a playoff position, have won back-to-back games.
The teams were deadlocked 1-1 heading into the final period, but the Senators took the lead when Eric Gryba scored 1:41 into the stanza.
Steve Ott brought Buffalo back into a tie by tipping in a shot less than 2 minutes later and overtime was looming when Flynn and Hecht came through for the Sabres.
Flynn's goal came with 5:23 to play and Hecht quickly followed with a backhander that got past Robin Lehner.
Ryan Miller made 35 saves for the Sabres. Ottawa, which was in fifth place in the Eastern Conference starting Friday's action, lost its third in a row. Lehner allowed the four goals on 30 shots.
2014: The Year in Music [PHOTOS]