Ryan, who gave the Ducks a 2-1 lead in the second period, shot past Carey Price on Anaheim's second attempt for the only goal of the tie-breaker.
Montreal's Max Pacioretty scored his second power-play goal of the game with 12.6 seconds remaining in regulation to send the game to overtime.
Koivu, who was in the penalty box for both of Pacioretty's goals, was called for three penalties in his first game in Montreal since he signed with Anaheim as a free agent prior to last season, including a tripping call late in the third that led to the tying goal with Price pulled for an extra attacker.
"It's a big two points for us but it didn't go the way we planned, with them getting the tying goal at the end and myself getting three penalties," Koivu said, "but at the end I'm happy that it's done."
Mathieu Darche scored with 3:40 left to pull Montreal to 3-2. Pacioretty tucked a rebound of Tomas Plekanec's shot from the right corner past Hiller, setting off a huge ovation from the sold-out crowd of 21,273.
"That was a good feeling but it got overtaken by the loss," Pacioretty said. "Those are two points that are so important and you hope to get both. It's always great to get a point but every point is so important, we would have liked to have two there."
"You give up a lead like that late in the third and it adds to it, obviously," Ryan said. "Saku's a very, very well respected individual in our room, obviously you can tell by the emotions of him and the fans tonight that he was very well respected here -- we certainly wanted to win for him and we're glad we did."
Hiller made 37 saves for the Ducks, who have won three of four.
"We kind of let them back in the game by taking those penalties," Hiller said. "It shouldn't have happened but that's the way it goes. I think the difference right now is we still found a way to win. At the beginning of the year we let the other team come back and we would end up losing."
Mathieu Darche scored with 3:40 left in the third to draw Montreal within one. Pacioretty scored a power-play goal earlier in the second for Montreal, which is 3-0-2 in its last five games, including a 7-1 win in Ottawa on Friday night. Price stopped 22 shots.
The crowd began a 90-second ovation for Koivu prior to the opening faceoff when images were shown on the video scoreboard during the final bars of the Canadian national anthem.
The Finnish veteran, who overcame a battle against cancer late in the 2001-02 season, patted his heart with his glove and raised his stick to the crowd as he skated alone while his Ducks teammates looked on from the boards and the bench.
"There's not really words to describe the feeling that I had out there, and then at the end after the game," said Koivu, who repeated the gestures when he was named the game's second star. "A great night -- it's going to be a memory that's going to go with me through the rest of my life. It's a good feeling right now."
Anaheim regained its one-goal lead at 2-1 with 3:34 left in the second when Ryan tipped Joffrey Lupul's shot past Price.
Teemu Selanne got his second assist of the game at 19:33 when Perry put home a rebound of Koivu's shot from the slot for the Ducks' second power-play goal.
Fowler opened the scoring with his fourth goal with 5 minutes left in the first. The rookie defenseman's point shot struck a pair of Montreal sticks on its way past Price.
Koivu faced the Canadiens for the first time last season in a 4-3 loss to Montreal in Anaheim on March 7. ... C Kyle Chichura, D Paul Mara and D Sheldon Brookbank did not dress for the Ducks. ... Canadiens C Jeff Halpern missed his second straight game because of an upper-body injury.