That's a good one. I'm not sure whether you would have to be on Q's level or if someone less powerful could do it though. It also depends on how powerful you think Q really is. He could definitely do it by going back to before the Big Bang and changing things or just taking the gems himself. Interesting also that we see no evidence that non-corporeal beings are vulnerable to the snap. The Q as a species may not even care about this.