I had to do this a few times to prevent a total reinstall of the system.
DNN actually provides a method to do this
DotNetNuke.Entities.Users.UserController.DeleteUsers()
I'd set the parameters as
DotNetNuke.Entities.Users.UserController.DeleteUsers(PortalId, false, false)
It will delete all the users from the specified portal. If you have multiple portals I'm sure there's a way you could get all the portalID's and loop it.
Hope that helps.