Roberto Martinez's side looked to be coasting to a 2-0 win after Seamus Coleman and Steven Naismith netted in the first half, but their defence crumbled in the dying minutes.
First, Ramsey bundled home a Santi Cazorla cross and then, with 30 seconds to go, Giroud headed past Tim Howard after some sloppy marking from Sylvain Distin.
Flamini said: "We have learned a lot from last year about playing these kind of teams away and we came back today and tried to be stronger. We didn't give up until the last second so it was a game to remember for us. There was great spirit from the boys today because we were losing this game."
On Giroud, who replaced Alexis Sanchez at the break, Flamini added: "Obviously he was very important as he gave us a plus and fought for every ball. It was a great help to us and then he scored the second goal so obviously he was great."
Arsenal had looked blunt and impotent in the final third for most of the match. Sanchez started as a lone front man, but despite his trickery and pace, he never troubled Phil Jagielka and Distin - who have a combined age of 68 - and he was hooked at half-time. Giroud fared just as poorly straight after his introduction, wasting a couple of good chances.
But the France striker came up with the goods in the final minute to send Everton fans home wondering how their team had failed to win.
Arsenal had the better of the opening 15 minutes, but it quickly became apparent they were lacking a clinical edge. Ramsey tried to carve open the home defence with a series of cutting passes, and there were plenty of fancy touches from Sanchez, but Howard remained untested in the Everton goal.
The only chance Arsenal mustered in the first half came when Coleman cleared straight to Alex Oxlade-Chamberlain. Luckily for the hosts, the England winger side-footed wide.
It took just a couple of minutes for Coleman to get back into Martinez's good books. The Republic of Ireland full-back climbed high at the back post to nod Gareth Barry's delicate chip past Wojciech Szczesny and give Everton the lead.
Romelu Lukaku played a part in the goal, selflessly ducking to give Coleman a clear header, and Mesut Ozil gave Everton a helping hand with some poor marking.
Arsenal were rattled, and they almost went 2-0 down moments later. Naismith looped a header over Calum Chambers and straight into the path of Kevin Mirallas, but his shot trickled inches wide.
Arsenal manager Arsene Wenger vented his anger at referee Kevin Friend for booking Per Mertesacker after a foul on Naismith and his mood darkened just before the break when Everton doubled their lead.
Lukaku shrugged off Mertesacker inside the Everton half and hurdled the sliding challenge of Chambers before sprinting at the Arsenal defence. The Belgian cut inside from the right flank and flicked the ball to Naismith, who beat Szczesny from close range. It was a beautiful goal, but one that should have been ruled our for offside, replays showed.