It took 20 minutes for City to muster a shot at goal as Phil Foden’s half-volley went wide. At the other end Diallo struck the outside of the post with a shot but he was offside anyway.
City’s fans were becoming restless but the tension lifted around the Etihad Stadium in the 36th minute as, from a short corner, De Bruyne’s cross was deflected and dropped invitingly for Gvardiol to guide a header past Andre Onana.
It was the eighth goal United have conceded from a corner this season, a figure only topped by Wolverhampton Wanderers.
Tempers boiled over soon afterwards as City’s Kyle Walker and Rasmus Hojland came together like two rutting stags and Walker fell theatrically to the ground, earning both players yellow cards after a melee involving several more.
United kept themselves in the game in the second half and should have equalised when Bruno Fernandes was played through on goal but his dinked finish drifted agonisingly wide.
City failed to even have a shot on target after the break and were left devastated as their world collapsed around them.
Nunes’s terrible back pass was seized upon by Diallo and he then compounded the error by hacking down the United player.
Fernandes tucked away the penalty, but worse was still to come for the hosts as Diallo nipped in to grab the winner.