Ultimately finishing seventh on the stage, Alaphilippe attacked on the final climb with just 2km to go, and when Sagan and van Avermaet joined the Frenchman, the race looked over for Matthews.
Several teams worked hard to neuter the attack, bringing back the danger men just beyond the red kite, the Australian winning comfortably in the end.
But Matthews' triumphant joy was tempered as he assessed the final kilometres.
"I’m not exactly sure how I did that,” he said. "I made a big mistake at the bottom of the climb. I wasn’t in a good enough position and when all the big favourites went I was not in the position to go with them which I’m really angry with myself about but they came back and I was still able to have good legs for the sprint.
"It’s a win but it's definitely a big mistake also in the final."
“I was really kicking myself in the final there that I wasn’t with the best guys going over the climbs. I think I was lucky that these guys looked at each other in the final straight and I was able to have a shot at the sprint."
Despite the self-awareness, Matthews knew what it meant to take his second Grand Prix Cycliste de Quebec victory in a row.
"The field is maybe a bit better this year. "It's a massive motivation going into the worlds. We’ve got the best riders in the world here, Sagan and Alaphilippe.
"The season hasn’t been great again so it’s nice to show the Aussies that I’m ready and that I’m ready to fight for them."
Matthews said his victory also rewarded the efforts of his team mates who chased hard to rein in the break.
"I think that was another reason I dug so deep to still give it a go. They rode amazing today and I'm just happy that I could finish it off. "
Evan Burtnik and Adam Roberge (Canadian national team), Luis Mas (Movistar), Guy Sagiv (Israel Cycling Academy), Gavin Mannion (Rally UHC) and Julien Bernard (Trek-Segafredo) got away early on the 200km race over 16 laps of the 12.6km circuit in Quebec. But once their lead reached a healthy seven minutes, the team mates of Sagan, van Avermaet and Matthews worked hard to shut it down as the race hit the final laps, all reeled in before the last two laps.