Miller played his first game back in Buffalo since being traded in February 2014, after more than 11 seasons with the Sabres.
"It was a big part of my life and it was nice to come back here," Miller said. "Would have been nice to have a better ending, but that's how it goes."
The Sabres enjoyed the ending. Ristolainen's goal was the Sabres' latest regulation game-winning goal since Mike Grier scored at 19:55 on March 11, 2006, at Philadelphia.
"It was pretty exciting," said Ristolainen, who had his first career two-goal game. "But two points are a big thing for us."
Jamie McCabe also scored for the Sabres. Jack Eichel, the 18-year-old center Buffalo drafted with the No. 2 overall pick, had two assists for his first career multi-point game and rookie Linus Ullmark made 35 saves.
Ullmark was chased after giving up three first-period goals in the Sabres' 4-1 loss to Tampa Bay on Thursday night. He responded with a career-high save total in his third win in five starts.
"He made some tremendous saves," Sabres coach Dan Bylsma said. "Probably the best player on the ice for us."
Henrik Sedin and Chris Higgins scored for the Canucks in the first of a seven-game road trip. Miller made 19 saves.
"That's a tough one," Daniel Sedin said. "We deserved better."
The game seemed destined for overtime until Tyler Ennis set up the winning goal. Ennis intercepted Daniel Sedin's pass and at the opposite blue line and weaved through four defenders before feeding Marcus Foligno in front of the net. Foligno sent the puck back out to Ristolainen at the point for a slap shot that gave Buffalo the win.
"That was all Tyler Ennis," Foligno said. "Those were amazing moves he made to get in the zone."
Vancouver tied the game at 2-2 with 9:36 left in the third period. Higgins sliced between Buffalo's Matt Moulson and Jake McCabe on the right side of the net and poked the puck through Ullmark's legs for the unassisted goal, his first of the season.
Higgins played in his second game after missing the first 11 games with a fractured foot sustained blocking a shot in the preseason opener.
"It was good for Higgins to come back," Canucks coach Willie Desjardins said. "I thought he played better tonight. It was good to see him rewarded with a goal."
After being outshot 15-4 in the first period, the Sabres regrouped and scored twice in the first 8:10 of the second period.
McGinn positioned himself in front of the net and redirected Mark Pysyk's shot from the point past Miller's stick to give Buffalo a 1-0 lead 2:18 into the period. Pysyk's shot came off a pass from Eichel.
Ristolainen's power-play goal put the Sabres up 2-0. With McGinn screening in front of the net, Ristolainen took a pass from Eichel at the left point and unloaded a slap shot past Miller.
The Canucks cut it to 2-1 with 6:27 left in the second period. Daniel Sedin collected the puck on a backhand pass from Ben Hutton along the right board and sent a cross-ice pass to twin brother Henrik Sedin, who flipped a short shot over a sprawling Ristolainen and under Ullmark's blocker.
NOTES: Miller beat Buffalo 5-2 in Vancouver on Jan. 30 in his only other game against his former team. He sat out with a sprained knee when the Canucks lost 6-3 at Buffalo on Feb. 26. . D Carlo Colaiacovo (upper-body injury) and D Tim Schaller were scratched for Buffalo. . The Canucks scratched RW Adam Cracknell. ... The announced crowd was 19,070, Buffalo's second sellout of the season. ... The Sabres, who entered Saturday leading the NHL with an average of 32.7 shots in goal, matched a season-low with 22 shots.