"It's amazing sometimes, you sit back and look at how simple you have to play," Miller said. "That's when the ice seems to open up. When you stop your feet, keep looking for plays and making something out of nothing is when you get yourself in trouble."
Hertl scored from close range with 50 seconds left to make it 6-5, but the Sharks did not have another shot on goal the rest of the game.
Hayes returned to the lineup after missing six games with a leg contusion and gave the Rangers a 1-0 lead at 5:45 of the first period when he scored on a slap shot from the left circle.
"Legs were a little heavy, but it was nice to get some offensive opportunities early to get the confidence back," Hayes said.
Goodrow scored on the rebound of a Brent Burns shot to tie it 1-1 at 6:45, and Couture scored with a sharp-angled wrist shot from below the left circle at 10:56 to give San Jose a 2-1 lead.
Fast beat Dell with a wrist shot with 2:07 left in the first to tie it 2-2.
"We needed a win," Vigneault said. "After another good start, we were able to have a real strong second period, and I think that was the difference in tonight's game."