Simple theory really, just had a thought that maybe Miles’s ability comes from being born on the Island where the spirits of the dead who can’t move on seem to linger – perhaps also affected by both his child self and adult self existing in the same timeline? (On a side note I recall him acting weird around Claire after her house exploded but she escaped unscathed, as if she was actually dead…? And MIB bought her back…but why?)
As to why Hurley can see dead people too…who knows. Maybe his craziness opened his mind up to all sorts of possibilities?