Yes. Depending on the fiction, if the ghost isn't a soul but instead a psychic/spiritual remnant, both can happen and the soul can have gone to the afterlife too. You can do a lot with fiction.
Story pitch: Soul gets to leave hell for one night to convince someone to put down their zombie corpse so their ghost will demanifest and they can finally go to a better afterlife.