Thornton, standing alone to the left of the goal, got a perfect rebound off a Dany Heatley shot and whipped the puck past Detroit goalie Jimmy Howard with less than 8 minutes to go, sparking the Sharks to seize control of the series.
Joe Pavelski scored twice and added an assist to continue his hot post-season, scoring in his fifth straight game. Ryan Clowe got the other Sharks tally and Heatley added three assists in the win.
Evgeni Nabokov turned aside 28-of-31 shots, getting stingier as the game went on. After letting in two first-period goals, the Russian netminder stopped 23-of-24 the rest of the way.
The Red Wings got a goal and an assist from Pavel Datsyuk while Tomas Holmstrom and Niklas Lidstrom also scored in the defeat.
Howard made 41 saves but Detroit was whistled for 10 penalties, including five in the final period.
The Sharks will take their 2-0 lead to Detroit for Tuesday's Game 3.