Marchand put Boston ahead 1-0 at 5:02 of the first period when he pulled a loose puck from below the goal line and lifted it near side over Binnington.
Hayes tied it 1-1 at 6:07 with a one-timer off a pass by Kasperi Kapanen from behind the net.
"I kind of just came around the net and saw him in the slot," Kapanen said. "He's got a good shot. I think he needs to shoot the puck a little bit more maybe. Just happy he shot it there."
Hayes had a second goal overturned at 9:55 when the Bruins successfully challenged that he was offside prior to the goal.
McAvoy put the Bruins back in front 2-1 at 6:26 of the second period, shooting five-hole on Binnington after a St. Louis turnover.
Neighbours tied it 2-2 at 10:57 on the power play off a cross-crease pass by Jordan Kyrou.
Marchand's 5-on-3 power-play goal gave Boston a 3-2 lead at 7:43 of the third period.
Sundqvist tied it 3-3 at 14:47 when he tipped a Scott Perunovich shot at the top of the crease on the power play.
"Happy to be able to get one back for the team," Sundqvist said.