Penguins rookie goaltender Casey DeSmith made 34 saves in his second straight start, the second of his NHL career.
Conor Sheary scored for Pittsburgh (25-21-3), which went 1-2-0 on its California road trip.
"We just couldn't get those opportunities, our second and third ones, that were important especially in a close game like that," Penguins captain Sidney Crosby said. "You've just got to bury the puck. At the end of the day, it's just execution. I had some really good looks and, you know, put a couple of those in, it's a different game. … We competed hard, we generated some good looks. Power play too. Same kind of thing."
Hertl scored on the power play to give the Sharks a 2-1 lead at 1:53 of the third, four seconds after Penguins defenseman Jamie Oleksiak was called for cross-checking Joonas Donskoi. Joe Pavelski redirected Brent Burns' point shot, and Hertl put the rebound into a wide-open net.
The Penguins pulled DeSmith with 2:15 remaining. San Jose missed three shots at the empty net, but Pittsburgh didn't get a single shot through against Dell with the extra attacker.
Sheary gave Pittsburgh a 1-0 lead at 3:18 of the first period. Dominik Simon tracked down his own rebound behind the net and passed the puck in front to Sheary, who beat Dell between his pads for his first goal in eight games.