Well if that wouldn't be considered a deus ex machina, I don't know what would.
Almost sad how predictable it was that something like this was going to happen. THE chapter after things start to turn sour for Fairy Tail. I mean, yes I'm glad Gray's back, but come on. Lame way to play it out, in my opinion.