San Jose has won two straight games to extend the best-of-7 series and will host Game 7 on Tuesday.
The Sharks were killing a slashing penalty called on Barclay Goodrow 31 seconds earlier.
WATCH: [Sharks vs. Golden Knights Game 6 highlights | Complete series coverage]
Hertl got the puck in the center circle after a pass from Marc-Edouard Vlasic, skated into the zone, and scored from above the left face-off circle.
It was the first time in NHL history that a multiple overtime game was decided by a shorthanded goal.
"At first when I got it, I was already a little bit tired," Hertl said. "I was thinking maybe just dump it in and change, but I saw the space. I just took a couple of steps and tried to shoot it. Maybe [Vegas defenseman Shea Theodore] hit my puck a little bit. If you don't try, you'll never know. Somehow it got through."
Martin Jones made 58 saves, the most in San Jose history.
"We knew [Jones] was on," Sharks captain Joe Pavelski said. "You could feel it, for sure. You're looking at the scoreboard and the shots are what they are, but [Jones] was moving, seeing the puck. Guys weren't getting behind us. We hung in there, and he gave us enough to get that win."