Alexander Barabanov, Logan Couture, Timo Meier and Hertl each had a goal and an assist, and Evgeny Svechnikov also scored to help the Sharks get their first win since Oct. 27 and only their fourth in 16 games. James Reimer had 25 saves to end a personal four-game losing streak.
''We're slowly learning what it takes to win hockey games,'' said first-year Sharks coach David Quinn, who recorded his 100th NHL victory. ''We're still fragile from the last two weeks with the losing we've done and the way we've done it, but we took a step forward tonight.''
Couture also had a second-period fighting penalty with Jamie Benn, giving him a Gordie Howe hat trick. It was his fourth fight in 14 NHL seasons.
''It just happened,'' Couture said. ''I hit a guy good, and Jamie came over and grabbed me right away.''
Benn scored twice in the first period and Roope Hintz and Joe Pavelski also scored for the Stars. Jason Robertson had two assists.
Jake Oettinger gave up all five goals on 18 shots after coming in leading the NHL in goals-against average (1.40) and save percentage (.952). He allowed more than two goals for the first time this season in his return after missing four games with a lower body injury.
''There's no easing into it in this league, and I was hoping for better tonight,'' said Oettinger, who played two seasons for Quinn at Boston University.
The Sharks were 0-2-3 in their previous five games, including losing 5-3 Thursday night at St. Louis.
The Stars have lost two straight, matching their longest losing streak of the season.
The Sharks broke a 2-2 tie with two goals in the first 65 seconds of the second period.
Meier whistled a wrist shot off the far post only 29 seconds in, extending his goal-scoring streak to five games. Just 36 seconds later, Couture scored from just inside the right circle to make it 4-2.
The Stars had a goal disallowed when a video review showed Tyler Seguin's shot caromed off Reimer's stick and off the bottom of the crossbar.
The Sharks scored at the 29-second mark again in the third period when Hertl corralled a rolling puck near the crease and netted a backhander for a three-goal lead.
Hintz hit from the right dot 6:18 into the third to pull Dallas back within two goals, and Pavelski's rebound goal while falling forward made it 5-4 at 12:06. Hintz has a seven-game points streak.
Benn started the scoring in the first period as he skated in from center-ice on a 2-on-1, kept possession and wristed from the left circle under Reimer's glove for the game's first goal at 4:42.
The Sharks tied it on Barabanov's first goal of the season 10 seconds into a power play at 6:13.
Svechnikov gave San Jose a 2-1 lead with 7:42 remaining when he beat Oettinger stick side after Dallas committed a neutral-ice turnover.
Benn tied the score 2-2 with 20.4 seconds left, going top shelf over the glove again. He has six goals in his last four games after going goalless in the first 10 games.
Robertson had a six-game goal streak snapped, handing the active lead to Meier at five games. ... Dallas allowed five goals for the second straight game after allowing 2.17 through its first 12. ... Pavelski, 38, played in his 1,182nd regular-season game, putting him in 18th place among U.S.-born skaters. ... Dallas has scored first in 12 of 14 games, dropping to 7-4-1 in those games. ... Stars F Matej Blumel made his NHL debut with F Denis Gurianov sidelined by an upper body injury.
Sharks: At Minnesota on Sunday night in the third of a four-game trip.
Stars: At Philadelphia on Sunday to open a three-game trip.
AP NHL: https://apnews.com/hub/nhl and https://twitter.com/AP-Sports
Copyright 2023 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.