What can I do to remove this entity definition from the database?
First solution (the best one if you can) (thanks @Clive) :


Put the deleted code back
Uninstall the module
Reinstall the module with the new code


Second solution (ugly, but worked for me)


Open your favorite SQL client (adminer in my case)
Search for your entity id in all tables
Remove all matching entries
Clear the cache