So what you're asking is 'if someone spams then hides their post, does it still count as spam'?
Well PM, Mods and Editors can still see your post even if you've hidden it, so yes it would still count as if you spammed.
I'm not sure why anyone would want to spam then hide their post anyway, they will probably still just end up getting banned or receive a warning, regardless of whether or not they've hidden their post.