In the league's first Friday night start, Arsene Wenger's side was trailing 3-2 with seven minutes remaining but Ramsey grabbed the equaliser and Giroud headed in an 85th-minute victor.
Although Arsenal signed off in May by lifting the FA Cup, a fifth-place finish ensured the north London club failed to qualify for the Champions League for the first time in two decades.
Shinji Okazaki cancelled out Lacazette's opener with a close-range header after Maguire had been left unmarked to nod Marc Albrighton's deep cross back across goal.
"I will be remaining at Arsenal", Giroud told SFR Sport. He doesn't want to leave and I'm happy that he wants to stay, but at some stage I opened the door for him because I knew I had many strikers. "He has a big weight in the squad and it was a relief for me that he made a decision to stay".
"I went to a three-man midfield to get us a screen because Mesut Ozil was playing in the pockets and I wanted Wilfred Ndidi to get in and around him. You saw the desire to get on the end of the corner, terrific".
The Gunners were a goal up inside two minutes as Alexandre Lacazette scored on debut with only his second touch of the game - heading in Mohamed Elneny's cross. "We kept going and the spirit of the team was absolutely outstanding", he said. The Frenchman can certainly find the back of the net and his effort here led to an entertaining game, although the former Lyon man will be anxious by what he saw at the other end of the pitch.
The match seemed to be following the normal script as the Gunners trailed the visitors 3-2, until Aaron Ramsey levelled things up with seven minutes on the clock, before Giroud sealed the three points in the 88th minute with a thunderous header.