Detroit (4-4-1), which ended a three-game losing streak, also got a goal and an assist from Mathieu Schneider. Dominik Hasek made 22 saves, including a tip attempt and rebound by Steve Bernier with 37 seconds left and a backhander by Milan Michalek from in close with 30.2 seconds left.
The Red Wings had only scored three goals in the three losses.
"When you start to press, it's not easy," Detroit coach Mike Babcock said. "It was nice to see the guys have some success."
Bernier scored the lone goal for San Jose (7-3-0).
Lang broke a 1-1 tie with 8:58 remaining by tipping in a shot from the right point by Schneider for his third goal of the season. Schneider one-timed a pass from the left point by Lebda and Lang, left alone in front of the net, tipped it in.
"It was just one of those things where he [Schneider] made a really good play at the right time," Lang said.
Schneider's power-play goal 38 seconds into the third period made the score 1-1. Schneider beat Evgeni Nabokov, who was being screened by Tomas Holmstrom, with a one-time slap shot from the top of the right circle that was a knuckleball.
"[The puck] just went end over end off the top of the toe of the blade of my stick," Schneider said. "One of those flukey goals, but I'll take it."
Detroit has also struggled on the power play this season. The Red Wings have had one of the game's most potent power plays in recent years but came into the game ranked 29th out of the 30 NHL teams with a 4-for-46 (8.7) percent. They were 1-for-4 on Wednesday night.
The Sharks, who came in with the NHL's top power play, beat the Red Wings 5-1 last Thursday night with five power-play goals.
Nabokov finished with 21 saves.
The Red Wings had a 39-23 shots advantage for the game.
"We didn't work. Our forwards looked like they were auditioning for the Ice Capades," San Jose coach Ron Wilson said. "A bunch of guys looked like they were just waiting for a power play. "
Despite being outshot 14-4, San Jose led 1-0 after one period.
The Sharks took advantage of Johan Franzen's interference penalty late in the first period with Bernier's power-play goal with 2:50 left in the opening period. He beat Hasek with a one-timer from the bottom of the left circle off a pass from Milan Michalek. It was Bernier's third goal.
"If we would have maybe matched their intensity," San Jose's Patrick Marleau said. "There would have been a different outcome."