The Gunners had won just one of their last seven opening-day fixtures and looked destined to start another campaign slowly as the 2015-2016 champions took the lead twice.
The night started perfectly for Arsenal as new signing Alexandre Lacazette marked his league debut with a goal after just 94 seconds, only for Shinji Okazaki to cancel it out three minutes later.
Jamie Vardy then capitalised on awful defending to twice put the Foxes ahead either side of Danny Welbeck's equaliser before Arsene Wenger sent on the cavalry.
Substitute Ramsey rifled home to level before Giroud - introduced alongside the Wales international - headed in an 85th-minute winner to settle a breathless encounter in Arsenal's favour.
Lacazette converted his first chance in the Premier League, heading home Mohamed Elneny's inch-perfect cross to send the home fans into raptures.
But Arsenal's defence, with essentially two fullbacks playing in their back three, were soon caught out having been given a warning when want-away Leicester winger Riyad Mahrez volleyed wide.
Petr Cech was largely at fault, coming off his line but getting nowhere near Marc Albrighton's deep cross as Foxes debutant Harry Maguire headed back across goal for Okazaki to nod in.
Arsenal reacted well and started to box Leicester in, Welbeck seeing a shot blocked before he dallied on a later effort.
Sead Kolasinac marked his debut with a goal in the Community Shield and forced Kasper Schmeichel into a smart save here with a driven shot from just inside the box, but the Gunners again fell behind to Vardy's strike.
Elneny played a pass to Granit Xhaka who, with very little space, gave the ball away to Albrighton and the former Aston Villa man crossed for Vardy to tuck away his chance from close range.
Okazaki nearly made Arsenal's first half even more galling but he could only head narrowly wide with the home defence all over the place.
Arsenal wanted a penalty for handball against Wilfred Ndidi with referee Mike Dean unmoved, but the equaliser came on the stroke of half-time after Kolasinac unselfishly squared to Welbeck with the goal gaping.
Mahrez saw an effort tipped over by Cech as Leicester looked to regain their advantage - something they did from the resulting corner as Vardy, completely unmarked, headed home Mahrez's set-piece.
Schmeichel was alert to prevent Hector Bellerin finishing off a slick Arsenal attack before Ramsey headed inches wide with his first touch.
With time running out, Ramsey made sure he did not make the same mistake as he fired past Schmeichel from Xhaka's pass with eight minutes remaining. There was, however, a strong suspicion of handball by Ozil ahead of the corner that indirectly led to the goal.
Schmeichel's brilliant diving stop denied Lacazette a fourth but, from the corner that followed, Giroud headed home off the underside of the crossbar to seal a remarkable three points.