JJ Peterka scored twice and Dylan Cozens collected three points as the Buffalo Sabres roared back from an early two-goal deficit to defeat the San Jose Sharks 5-2.