Thornton also had an assist, and Milan Michalek and Joe Pavelski had two assists each for the Sharks, who have won four of their last five games. Evgeni Nabokov had 32 saves for San Jose, which trailed, 3-2, with 7:45 left to play.
Dustin Penner's power-play goal put the Ducks ahead, 3-2, at 12:15 of the third, but Jonathan Cheechoo got the equalizer for the Sharks 31 seconds later.
Thornton's power-play goal five minutes later decided the game.
Police: Sword-wielding man demanded free tacos
Wisconsin business offering 'therapeutic cuddling' forced to close