"Deletion" in terms of using the Moodle administrative interface is exactly that, it doesnt completely remove users, so you are right, ideally you'd just want to use a query to update the deleted field.
I've added a reply to the other forum thread you referenced with an updated query for selecting the users who have never logged in and also a query to set these as being "deleted".
You can see that here...
Hardware and performance
Automatically delete users who never login
This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.