The home fans were thinking their players would get a point from this game, but Lacazette broke their hearts when he scored the winning goal for Arsenal in the 81st minute.
Cardiff's high press made it an uncomfortable start for Petr Cech between the Arsenal sticks, with the experienced goalkeeper nearly caught out on a couple of occasions inside his own box.
Cech later passed the ball straight to Harry Arter who blasted over with only the goalkeeper to beat.
The visitors nearly went ahead moments later after a short corner on the right was worked to Alexandre Lacazette, whose clever backheel found Aaron Ramsey in space, but the midfielder's low shot from 10 yards out was saved by Neil Etheridge and Mustafi failed to keep the rebound down. However, both sides seemed determined to gift chances to the other with consistent mistakes dominating the opening 10 minutes. "I think we controlled the match 70 per cent on the 90 minutes".
His introduction of Lucas Torreira helped turn the game in Arsenal's favour but the midfielder should arguably have started ahead of Granit Xhaka.
Ryan Giggs dismisses Jose Mourinho replacement talk backs Manchester United response
With pressure reaching a boiling point on Mourinho's job status at Old Trafford , expect his responses to only get better. Despite the result, Mourinho said "by strategy we didn't lose, tactically we didn't lose, but we lost the game".
Cardiff another super chance late in the first when a header from Sean Morrison fell for Arter in a unsafe position, but the on-loan Bournemouth midfielder sent the ball into the stands.
Lacazette looked threatening throughout with an early effort deflecting off the post.
Arsenal wasted a number of chances afterwards and were made to pay for those missed opportunities when Victoria Camarasa levelled scores for the hosts in the second minute of added time in the first half. Aaron Ramsey was vast, Lacazette played both creator and finisher while Pierre-Emerick Aubameyang took his goal superbly.
Shkodran Mustafi and Pierre-Emerick Aubameyang - with his 150th goal in the top five leagues of European football - twice gave the Gunners the lead before Alexandre Lacazette settled matters nine minutes from time.
FW Alexandre Lacazette, 8 - Finally got a starting place and nearly repaid Emery handsomely on 33 minutes when smacking a shot off the post.
It proved costly as Mustafi powered a header home from the resulting corner to give the north London giants a deserved lead.