Sorry, this situation really sucks. They will not unlink the accounts unless the psn account was compromised. For sure they will not "refresh" your code so as far as that goes you just bought your friend a game.

Probably your best recourse is to have your friend contact SE via live chat to complain that you linked his ps3 account to your SE account and that he'd like them unlinked. Their policy only allows them to unlink the accounts if his psn id was compromised by a third party. I suppose he could argue this is the case here as you technically had unauthorized access to his account and he cannot enjoy the game for himself without unlinking them first.

I hope you can get this resolved.