According to the document, not all records are deleted when a user is deleted. If you hard delete the ghost user, I think this will mean you’ll loose association of these records to an user. For example, if you look at the merge_request table, there’s a column for author_id. If you delete the ghost user directly from the database, you’ll loose the association of this row to a user so I think you’ll get a system error or at least not be able to access the associated merge request.
There’s a column named “ghost” in the users table. Have you tried setting this column to “false” for the ghost user?