Q:

Moving through the space of an invisible enemy creature in combat

In my last session the party was fighting some Wyverns. When one got near the sorcerer, he became invisible and moved out of its reach, but stayed between the Wyvern and the warlock. On its next turn, the Wyvern moved to attack the warlock, but to do so, it would have to move through the sorcerer's space.
On page 191 of the Player's Handbook, it states under "Moving Around Other Creatures":

[...] you can move through an hostile creature's space only if the creature is at least two sizes larger or smaller than you. Remember that another creature's space is difficult terrain for you.

The Wyvern is a Large creature, so it can't move through the space occupied by the sorcerer, but it would definitely try to do so to attack the nearest enemy.
What should be the proper resolution of this event according to the rules? 
I made my call by letting the Wyvern, a Large creature, pass through the space and gave the sorcerer a choice to make a Dexterity saving throw to avoid being trampled, or a Strength saving throw to stop the creature's movement. The PC chose Dexterity and failed, so he got trampled. I considered the space difficult terrain for the Wyvern, used 2d6+4 as trample damage (same as for its Bite attack), concluded the movement out of the square occupied by the PC, left him prone, and made only the Stinger attack to maintain the average damage output.
I let my group know that it was my call to avoid stopping combat and searching for rules, and that in the future, the same situation may be managed differently according to official rules, but what are those rules?

A:

The Wyvern is unable to pass through the Sorcerer's space and must move around them or attack them.
It would seem there are no additional rules that come into play here, either from invisibility or movement, so unless your monster has a trample ability, it would not be able to move through the Sorcerer's space, as per your quoted movement rule. (It feels a little weird that your Wyvern can't move over a weedy Sorcerer, but imagine it was trying to bypass a jacked-out Orc Barbarian who is also medium size and probably trying to defend the Warlock, and it feels like a reasonable rule.)
So what should the Wyvern do?
Firstly, it moves up to the Sorcerer and "can't enter that space". If you were describing this to a player, you might say they collide with an invisible force. Your player wouldn't do any damage for accidentally walking into an invisible monster, and neither does your Wyvern, despite the size difference.
Now; moving in 5e can be split up in as many ways as you like, so at this point the Wyvern has a number of options:
Option 1: "The Wyvern guesses the invisible force is the Sorcerer that just disappeared." If the Wyvern's been paying attention, this could make sense, and if the Wyvern considers them a dangerous target attacking them again is reasonable - Attack the invisible Sorcerer at disadvantage. (Feels harsh if your Sorcerer was really trying to avoid the attack, but you'll teach your player to also get out of the way.)
Option 2: "The Wyvern has no idea what the invisible force is, and tries to shove it aside." - Use the Shoving a Creature rule. If you successfully shove them out of the way, continue moving on to attack Warlock if you have any attacks left.
Option 3: (If you're not fighting in a 10ft wide corridor). "The Wyvern bumps into something, and like you would do in a frantic fight situation, just continues around it." - Move around the Sorcerer, potentially provoking an attack of opportunity (which, if the Sorceror makes, your Wyvern could then just turn around and bite them; remember that it can always break up it's movement in response to the situation changing).
If you are in a 10ft wide corridor, then you'll have to pick one of the other two options, either using attack actions to shove the invisible player until you can reach the Warlock or eventually deciding to attack the invisible player - depends how stupid your creature is.
With my players, I favour Option 3, but if you want to teach your players that Invisibility isn't Invulnerability (as some players seem to think) go for 1, and yours will soon learn to also get out of the way.

A:

First, about your scenario specifically:
Do be aware that being invisible is not the same as hidden.
Did your sorcerer take a hide action? To even lose the Wyvern's awareness he'll have to surpass its passive perception of 14.
If he did roll at least a 15, did you consider using a turn on an action to roll the Wyvern's +4 perception against his stealth roll? 
Your sorcerer still makes noise when he walks and smells and sounds when he burps. The wyvern could easily pick that up unless your sorcerer sneaks. That way your sorcerer may well have still been the target of the Wyvern.
Now, to answer the question on movement.
Is a hiding and undetectable creature hostile?
Assuming the Wyvern completely lost track of the hiding sorcerer, I'd like to argue that the sorcerer, currently invisible and focusing on averting the wyvern, is not hostile towards the creature while he is invisible. Likewise the wyvern is not hostile against that which it can't percieve.
And since any creature can move through the space occupied by a non-hostile creature (i.e. allied or neutral) you could let the wyvern walk through the square of the currently non-hostile sorcerer. If he wants to stay hidden he can do so and let the wyvern pass. If not, he can reveal himself with an opportunity attack.
However:

another creature's space is difficult terrain

The Wyvern would be slowed to 15ft instead of its usual 20.

