The Red Wings won their first five games this season, but have now lost three straight.
Tomas Holmstrom tied it for the Red Wings with 5:16 to go in the second, scoring his first goal of the season on the power play.
Thornton then gave the Sharks the lead by putting a wrist shot past Jimmy Howard with 1:42 to go in the second. Thornton scored again into an empty net with 35 seconds remaining in regulation.
Antti Niemi made 32 saves to get the victory. He has been in goal for every game of San Jose's current winning streak.
Howard stopped 26-of-29 shots.