This is a complete no brainer. Your contract was with the previous home owner. Once the house sold your not obligated to hand over anything. If the new homeowner wants to pay you for service or buy the code then let him. The new homeowner has no leg to stand on.
Even if the previous homeowner stated or signed something that said you would provide the code you dont have to. Neither of them can include you in a contract between them. Thats just him trying to scare you with the word "lawyer".
If he wants to be a bitch about it tell them this "oops i deleted it by accident, sorry about that".
Avid Stamp Collector - I really love 39 Cent Stamps