Honestly, I think if you are building so many wonders that the production loss of them jeopardizes your game you're building too many in the first place. For instance, if you stopped to spend 15 turns on Hanging Gardens instead of investing in another worker and settler and now the city spot is gone and you lost the wonder a turn or two from completion, it isn't losing the wonder that's the problem...It's that you stopped at a critical expansion time when you really needed another settler. Wonders are generally best built when your capital has built a good core of surrounding cities to do the main work of the empire. In this case, no amount of losing really messes up your game. You get a little gold and you should get some of them. They are perks...nice to have, but the real focus is on growth, infrastructure, and science.
what MIGHT lose you the game is not the loss of hammers, but the fact that a runaway AI gets something that helps them even more. aka: Korea, already ahead, scores porcelain tower or hubble (never lose hubble). There a few that can really help the AI so you want to keep it from them, but honestly, most of the wonders are completely optional and you'll do fine letting the AI take them. Korea scored porcelain on me just turns from completion on my last game and I was so ticked. He soared ahead by 7 techs and got research labs first too...but I buckled down...instead emphasized gold and beat him on economy. Buying factories and other buildings first and beelining and rushing hubble... A good trick if you really don't want to lose a wonder like hubble is to have an engineer lined up.
I reiterate though...if you are building so many that you end up regretting every hammer spent after losing because there were so many other things you needed to do, then do the other things first and forget about wonders for a while. My two cents at least. This doesn't mean you won't get wonders or shouldn't pursue them...just that building them should never jeopardize your game. My general strategy is to expand wide and only halt my capital for a wonder after I've built a few other cities and are above population 7 or so. In this case, if I lose it...I'm okay. If I had stopped and not settled and also lost it? way worse...so don't do that.