I have a little trouble understanding what you've said, but it sounds like you were on a starboard tack close reach, and tacked onto a port tack beam reach to get back home (meaning the wind was from the starboard side, and you were tacking to put it on the port side, with the boom then out to starboard, and broad-reach home?)
if so, and you still got knocked down with reefed main, I can only guess that the main was still not eased enough to avoid the side-pressure from the wind. If you're doing a "reach-to- reach" jibe, then you need the jib to be the predominant sail on the new tack, meaning trimmed in before the main--it will pull you forward, and not over sideways.
As I said, this is a guess based on what you said. But I'd guess you should've eased the main more, and trimmed the jib earlier, than you did. The jib will head you back off the wind. The main, if overtrimmed, will heel you without giving you much forward impulsion.
You won't really know until you try it again in the same conditions. In the meantime, you're asking the right questions. And if you feel you may have made a mistake, join the crowd and have a beer. Lots of us have gotten this boat-balancing question wrong in a stiff breeze. It depends on the weather, the boat, and the situation.