Restoring PS3 (Settings → System Settings → Restore PS3 System) does NOT delete your PSN account / Online ID. They are stored on Sony's servers, not the console.
Contact PlayStation Support (Live Chat / Phone): playstation.com/support. Provide:
Warning: No third party can "recover" your ID. Scams abound. Only Sony Support.
Just sign in again after restore. Your digital games (if licenses valid) reappear in Download List.