Van Riemsdyk was the only player to score in the three-round shootout and helped the Maple Leafs snap a four-game losing streak.
"Well, we can breathe," Maple Leafs coach Randy Carlyle said. "There's been a lot of gasping going on, and even in this game there was a lot of gasping going on, how tight it was."
Toronto grabbed the lead when Tyler Bozak scored at 15:53 of the first period. Bozak capitalized on a rebound after a flurry of shots from Phil Kessel and van Riemsdyk. Bozak finished it off by sliding a Kessel rebound underneath Devils goalie Cory Schneider, who started a third consecutive game for the second time this season.
"I think our last couple games we've given a good effort and played well, and we didn't get the outcome we wanted in Washington," Bozak said. "Tonight was better, and hopefully we can keep going off this one."
The goal was Bozak's seventh of the season and continued his hot streak since returning from an oblique injury on Dec. 29. In seven games since his return, he has eight points.
Adam Henrique tied it at 1:39 of the second period on the power play. Ryane Clowe fed a pass to Henrique, who fired a wrist shot past Bernier for his 11th goal of the season. It was Henrique's fifth goal and eighth point in the past nine games.
Van Riemsdyk scored on the power play to put the Maple Leafs ahead 2-1 at 5:56, when he collected a rebound from a Cody Franson shot in front of Schneider to score his 17th goal of the season.
"Van Riemsdyk was parked at the edge of the crease there and, as he was all night, he's tough to handle there and they got a pretty good shot off through the screen," Schneider said.
Clowe tied the game 27 seconds after van Riemsdyk's goal with his first goal of the season. Clowe scored a breakaway goal on the backhand to beat Bernier. It was his first goal since April 19, when he was a member of the New York Rangers.
"He's smart offensively, he scored a big goal for us tonight," Henrique said. "It was nice to see him get the first one, especially coming off the injury. He's been playing awesome. We've got to keep things going forward from here."
Toronto has won twice in regulation in its past 26 games.
"We needed this bad," Bernier said. "We found a way. If that's what it takes to go into a shootout and get points and move on like this, it feels good for the confidence."
The Maple Leafs thought they took a 3-2 lead on the power play at 10:03 of the second period when Bozak put a backhand rebound past Schneider, but officials waved off the goal and ruled van Riemsdyk interfered with the goalie. No penalty was called on the play.
"I was very surprised," van Riemsdyk said. "I looked at it after on video in between periods and I'm still kind of wondering. [The referee] gave me his thought and I asked him if he could watch it after the game and maybe next time we have a game he can apologize or something because that was pretty brutal."
Referee Ghislain Hebert made the decision on the play.
"There's contact there's always guys bumping you or fighting for position," Schneider said. "I don't know where he was in relation to me, I was more kind of falling back to try to make the save on the rebound. Sometimes you get bumped and it doesn't get called and that time fortunately it did. I think that was probably the first goal we've had disallowed all season, so we'll take it."
Schneider made 23 saves for New Jersey. The Devils fell to 0-7 in shootouts and have one goal in 23 shootout attempts this season.
"The shootout doesn't take away from the effort that we gave tonight," Devils coach Peter DeBoer said. "I thought we gave them everything they could handle. They're probably pretty fortunate they got two points and we feel a little bit robbed, but that's the game and we've got to pick up and move on to Montreal."