Hamhuis scored Vancouver's third power-play goal midway through the third period just minutes after Markstrom preserved a tie with a brilliant glove save that helped the Canucks beat the Sharks 4-2 on Saturday night.
''We've seen that before in the last couple of games against these guys,'' said Alexandre Burrows, who sealed the win with an empty-net goal. ''I thought we stayed pretty composed. We said keep battling and we might get a break. We were able to make a nice play on the power play.''
Michael Haley and Brent Burns scored for the Sharks, who fell six points behind first-place Anaheim in the Pacific Division. James Reimer made 22 saves in his San Jose debut but was hurt by San Jose giving up seven power-play chances.
''We got that first goal and then we started to take a lot of penalties,'' captain Joe Pavelski said. ''A lot of soft ones, too. It was everybody tonight. It was one of those nights that we couldn't stay out of the box.''
The Canucks lost star Henrik Sedin to an upper-body injury in the first period. Sedin got tangled up with Burns during a power play early in the first and fell to the ice. After being helped off by trainers, Sedin returned to play four more shifts before leaving again late in the first and not returning. He is not expected to play Monday.
After rallying from deficits after two periods to beat the Canucks twice in Vancouver the past week, the Sharks came back again in the third when Burns beat Markstrom with a wrister from the slot off a pass from Joe Thornton to make it 2-2 early in the period.
Markstrom had robbed Hertl earlier in the period with a shoulder save and then did it again with a glove save against Marleau during a delayed penalty to keep the score tied at 2.
''It's a desperation save,'' Markstrom said. ''It was a good pass. I didn't expect him to be there. Obviously they had the delayed penalty, so there were six guys on the ice. I kind of forgot about him and sometimes those go in and sometimes those go right in the glove.''
Joonas Donskoi then got called for a trip late in San Jose's power play and the Canucks made San Jose pay when Bo Horvat slid a pass to an open Hamhuis, who knocked it into the open net for his first goal of the season.
''It's been a while,'' Hamhuis said. ''Certainly had my chances over the year. It was nice to get one to go in, especially one that made such a big difference in the game.''
Haley was involved in both goals in the first period. He got San Jose on the board midway through the first when he stole a pass from Ben Hutton and fired a shot that trickled through Markstrom. That was Haley's first goal since March 19, 2011.
Haley then took a four-minute high-sticking penalty late in the first when he clipped Sven Baertschi. The Canucks capitalized when Vey lifted a rebound of Baertschi's point shot over Reimer to tie the game.
Vancouver added another power-play goal early in the second after Pavelski was called for a trip in the offensive zone. Baertschi then got the puck in the circle and fired a wrister that deflected off Daniel Sedin and past Reimer to make it 2-1.
NOTES: Canucks D Chris Tanev left in the third with an undisclosed injury. ... Vancouver matched a season high with three power-play goals, also doing it Nov. 21 against Chicago. ... Sharks F Melker Karlsson missed his second straight game with an upper-body injury.