It was the second overtime victory in the Western Conference semifinals for the Sharks, who can complete a series sweep Friday in Detroit.
Setoguchi took a pass from Joe Thornton from the right boards before snapping a shot that ticked off the stick of Detroit's Henrik Zetterberg and snuck by goaltender Jimmy Howard.
Setoguchi scored a power-play goal in each of the first two periods.
Pavel Datsyuk gave the Red Wings a 3-2 lead with 1:43 to go in the second stanza on a power-play goal, but Dan Boyle tied it with 4:08 to go in regulation. It was Boyle's first goal of the playoffs.
San Jose won the first three games of last year's conference semifinals against Detroit and eventually closed out that series in five games. The Sharks then lost in the conference finals to eventual Stanley Cup champion Chicago.
Antti Niemi made 38 saves for the Sharks. He is seeking his second straight Stanley Cup title, having been in goal for all 16 playoff wins by the Blackhawks last year.
Howard stopped 34 shots in the loss.