Ryan's goal in the third period broke a 2-2 tie, then he followed up with another goal five minutes later. He later set up Kamil Kreps' empty-net goal with 49 seconds left.
Rochester ended a two-game losing streak and improved to 43-28-1, remaining second in the North Division at 87 points. Toronto fell to 29-36-2-4.
Each team scored twice in the first. Robbie Earl's short-handed breakaway goal put the Marlies ahead.
Noah Welch tied the score at and Marek Zagrapan's goal put the Americans ahead, but the Marlies tied the score 2-2 when a crazy carom led to an empty-net goal by John Mitchell.
David Shantz made 35 saves for Rochester. Justin Pogge stopped 28 shots for Toronto.