The spell does what it says it does, and the condition (Grappled) does what it says it does. Victor is flung 10'.
The spell moves Victor 10'. Clear enough. Unless something would stop that movement.
The condition doesn't cause Victor to be immobile, it reduces his speed to 0'. He's not nailed to the floor or encased in carbonite, it's just hard for him to move of his own volition. Grab someone by the wrist with both hands: you've got them Grappled.
So, since nothing in Grappled says Victor can't be moved by an effect (and, in fact, as you mention it specifically mentions this effect as one that can move the victim out of the grappler's grasp) and the spell says it moves Victor, that's what it does.
As long as the effect of Thunderwave ejects Victor from Gary's reach, Victor is no longer grappled.
(As @MartinCarney rightly points out, if Gary's an Otyugh, even 10' may not escape Gary's reach!)
You must release the target to attack, probably ending the grapple
D&D 5e has a broad intent that any word which is not explicitly given special rules meaning, instead has its plain English meaning, though I don't have a citation prepared for it. In plain English we see this:
Using at least one free hand, you try to seize the target ... you can release the target whenever you like
While "release" technically has multiple meanings, I find this context unambiguous in having Release mean "stop holding with your hand". From this plain English reading, I think it's clear that between the time that you "seize the target" and the time that you "release the target" your hand is occupied by that target; in other words, in order to use both your hands for a 2-handed weapon attack or other purpose you must release the target.
There does remain some ambiguity as to whether that actually ends the condition though. The sentence in question states:
The condition specifies the things that end it, and you can release the target whenever you like
But there isn't a strict connection indicating that "release the target" is an additional thing, not part of the set specified by the condition, which ends the grapple. It does seem likely that it was intended to be so based on the juxtaposition of the concepts, and supported by the subsequent section which unambiguously states that the means of ending a grapple are not entirely restricted to those specified by the condition.
Regarding "Common sense"
In a comment you mentioned that you don't bring real-world common sense into D&D, which is fine. Sometimes the rules explicitly contradict reality; after all you can't complain about someone casting a fireball on account of "magic isn't real". However, D&D also isn't a computer Rules Enforcement System where ambiguous edge cases have a single answer that's always correct and non-negotiable. Instead, D&D is adjudicated by Some Guy who, in my experience, is much more likely to be swayed by "It doesn't make sense that my Half-Orc Barbarian is physically incapable of throwing a gnome" than by "the rules don't say that letting go stops the grapple"; your mileage may vary depending on the DM. In general, I would say that ambiguous situations not clearly covered by rules are more likely to take whichever interpretation most closely matches common sense even if other times common sense is ignored.
Best Answer
Default play: gridless.
Nothing stops a grappled creature from shoving.
"Grappled" zeroes out your speed, and that's it. (PHB p.290, "Appendix A: Conditions")
However, this may not break the grapple.
As you've quoted, the effect ends if the grappler's reach is exceeded. On a successful shove you can either knock your target prone or push them 5' away (PHB pp.195-196, "Shoving a Creature").
Knocking the grappler prone doesn't--by itself--move you out of the grappler's reach. Shoving the grappler 5' is... uncertain.
The one definite case I can think of (just for fun):
Summary: this sounds like an excellent space for a ruling, leading to a house rule.
Variant play: grid.
Nothing stops a grappled creature from shoving.
same as above
This will break the grapple of a 5' reach.
In grid-world even when grappled creatures are at a 5' "distance" because, as @daze413 rightly points out, grappling doesn't move one into the same square.
The shove then moves the grappler 5' farther away, exceeding a 5' reach. So: yes, in grid-world the equation is