Martin Odegaard put the Gunners in front just before half-time at Goodison Park with a neat volley from Kieran Tierney's cross.
But despite twice being denied by VAR, Richarlison equalised with 10 minutes remaining, before Gray completed the turnaround with a stunning 25-yard effort in the second minute of stoppage time.
Now without a win in four Premier League visits to Goodison, Mikel Arteta’s side missed the chance to return to fifth place in the table.
Everton was unbeaten in its three previous home games against Arsenal in the Premier League and made a bright start to proceedings.
Top scorer Gray and Abdoulaye Doucoure were off target, while Anthony Gordon had a shot blocked inside the box.
The host thought it had taken a 44th-minute lead when Richarlison headed in Andros Townsend's cross, but VAR denied them as the Brazil international strayed marginally offside.
The visitor capitalised in first-half stoppage time, Odegaard arriving late to neatly volley home Kieran Tierney's centre.
Odegaard almost turned provider eight minutes after the restart, the former Real Madrid midfielder’s cross finding Gabriel Magalhaes, whose header was saved by Jordan Pickford.
Everton and Richarlison were denied by VAR again four minutes later, the latter offside by a fraction once more as he received Doucoure's pass before slotting beyond Aaron Ramsdale.
But its persistence paid off 10 minutes from time, Richarlison reacting quickest to head home the rebound after Ramsdale had done brilliantly to turn Gray’s initial effort onto the crossbar.
Eddie Nketiah then squandered a glorious opportunity to snatch the points for Arsenal; the substitute somehow hitting the post with a close-range header.
It proved costly as Everton snatched all three points in the second minute of added time, Gray embarking on a strong run before bending a wonderful 25-yard strike in off the post.