What happens if you create and lose an Mt. Gox redeemable code? When you create an Mt. Gox code, you are shown a long textual code, and the amount is immediately deducted from your account.

What happens if you lose the code (e.g. your computer accidentally shuts down before you copy-paste the code into someplace safe)? Mt. Gox already shows the funds as if they don't exist in your account (even before they are redeemed).

If there a way to restore lost codes?
The code appears in your account history.  If it hasn't been redeemed, it also appears here:

Funding Options -> Redeem Codes

It also has a Cancel if you don't wish to use it (it simply redeems it to your own account).