Trailing 5-3 from the first leg in England, teenage starlet Kylian Mbappe put Monaco ahead on the night after just eight minutes at the Stade Louis II and Brazilian midfielder Fabinho converted the home side's second just before the half hour.
Leroy Sane's 71st-minute goal handed City a 6-5 advantage on aggregate, but Bakayoko turned home Thomas Lemar's free-kick 13 minutes from time as Monaco claimed a famous win.
Monaco go through to Friday's draw for the last eight in Nyon carrying French hopes following Paris Saint-Germain's shock elimination, while Guardiola suffered his earliest Champions League exit as a manager.
"In the second half we were much, much better but it was not enough. It happens and we'll learn, we have a team with not a lot of experience in this competition."
Also Read
Monaco hero Bakayoko will miss the first leg of the quarter-final through suspension but was delighted to advance.
"It's an immense joy to score in the Champions League. I didn't expect this," he said.
"Over two games we deserved to qualify. Now we want to keep going."
The French league leaders suffered a blow before kick-off as Radamel Falcao, who scored twice in the first leg, failed to recover from a hip injury in time and was replaced by the versatile Valere Germain.
Coach Leonardo Jardim had challenged Monaco to draw inspiration from the side which dumped out Real Madrid en route to the 2004 final, recovering from a 4-2 defeat in the first leg of that year's quarter-finals before knocking the Spanish giants out on away goals.
And the hosts were inspired by 18-year-old Mbappe, who has emerged as one of Europe's most promising talents amid Monaco's thrilling pursuit of the French title this season.
City recovered from twice falling behind in the first leg, but the opening goal emboldened Monaco as Germain unleashed a searing strike from distance that zipped not too far over.
Guardiola had emphasised the best form of defence would be attack for City, yet the visitors struggled to settle and Monaco grabbed their second goal in not dissimilar fashion on 29 minutes.
Mbappe's electrifying pace posed a constant threat for City, but the Premier League side gradually began to pose Monaco problems as well although Raheem Sterling's hesitancy allowed the hosts to clear as the England winger looked to tee up Sergio Aguero.
Sane broke in behind the Monaco backline once more but steered his effort the wrong side of the near post with Subasic charging off his line, but City finally broke through with 19 minutes left.
Sterling broke in from the right and his low shot was palmed away by Subasic, but Sane reacted quickest to thump the rebound into the roof of the net and change the complexion of the tie.