This seems like a very odd feature for Steam not to have already had, but there we go. If you pre-order a game through Valve's digital distribution service, you can now cancel that order and be automatically refunded for the cost of the game.
Previously cancelling pre-ordered items required you to contact Steam support in order to receive a refund, but now the funds will instantly appear in your Steam wallet and the game will be removed from your account.
Assuming you've let the platform update recently, the feature should already be a part of your client. Valve don't tend to announce this stuff, so its presence was first spotted in the wild by Steam forum user donham.
Of course, instead of relying on a feature like this, a better idea would be not to pre-order games. Pre-ordering is there specifically to hook you into buying a game before you have all the information necessary to make an intelligent purchasing decision. Developers will try to sweeten the madness of that with bonus weapons, items and missions, though normally the bonus materials are sub-par or actively imbalance the base game. The only world in which pre-ordering makes sense for players is one of genuine scarcity, which of course digital distribution eradicates.
Still, it's good news that you can refund your past mistakes.