Imagine in a PvP your phoenix lifts an enemy DT. Your observer moves away though and the DT becomes cloaked while lifted.
Does it remain lifted? Can it be attacked? What happens to it?
I find the best way to find out is to test it, made this video to show that as long as the Dark Templar is held by the Graviton Beam it can be attacked even if the observer moves away.
If Graviton Beam is used on a friendly Dark Templar enemy units can attack the Dark Templar
According to this article, if a phoenix lifts a Dark Templar, it remains visible and lifted for the duration of the ability. This means once you have the DT lifted, you can attack it with or without a detector nearby. Once the ability is done, however, a detector will be needed again to attack it or pick it back up.
The same would hold true for a ghost, or any other cloaked unit.