Leclerc, who had scored his sixth pole position of the season, dashed for a pitstop under a virtual safety car - induced by his teammate Carlos Sainz retiring with a hydraulics issue - to carry a 13-second lead.
But his chances of victory when up in smoke when his engine blew to hand the win to defending champion Max Verstappen, as Ferrari lost a potential win for the third race in a row.
The power unit used in Baku comprised a refurbished internal combustion engine, which was passed fit for use despite having been part of the configuration that failed while Leclerc led in Spain.
That retirement, which wiped out the turbo and MGU-H, left Leclerc to run in Azerbaijan with a blend of old and new components at a track with the greatest throttle demands on the calendar.
Ferrari has intimated that these carried-over parts could have caused the failure in Baku.
The Monegasque, who has not won since Australia, will now run a fully new powertrain set-up for this weekend’s Canadian Grand Prix after the Baku system was found to be “beyond repair”.
A Ferrari statement read: “[An] investigation confirmed Charles' Baku PU is beyond repair.
“One possible cause of the failure is that it occurred as a consequence of the PU problem in Spain.
“We are now working on countermeasures to strengthen the package and the situation is under control.”
The write-off of the Baku powertrain leaves Leclerc on the verge of at least a 10-place grid penalty as he bid to close a 34-point gap to championship leader Verstappen.
Ferrari, 80 points adrift of Red Bull, ushered in a revised powertrain specification for the Miami GP in a bid to improve reliability.
That second power unit, plus the new turbocharger for Baku, has put Leclerc up to the maximum-permitted three turbos for the season.
Speaking in Montreal, Leclerc said: “Obviously we are not in the best situation possible.”
Asked to confirm the situation regarding taking a grid-place hit for Canada, he continued: “Then for the power unit change, I think there are still ongoing discussions.
“For now, no decision is taken. But yes, it’s not the best position to be in.”
Despite the long back straight potentially favouring the top-speed credentials of Red Bull, courtesy of its strong rebadged Honda engine and low-drag set-up used in Baku, Leclerc reckoned Montreal could be a good venue to take the hit because of the passing opportunities.
He said: “It’s up to us to choose the best track where you want to get a penalty, if you get a penalty.
“This is one of the tracks where it is quite easy to overtake, but there are also tracks in the next three or four races where it’s quite easy to overtake too.
“So, we’ll discuss and try to take the best decision from there.”