I'm going to contradict the other two people and say only 3, based on the position in the sentence. The past-perfect form ("having been") is used to show that one thing happened before something else.
To use 4, I believe the sentence should be something like:
Having been up in a small, dark cupboard for hours last year, she still has nightmares.
You could also combine 4 and 3 to get the sentence:
Having been up in a small, dark cupboard for hours last year, she still has nightmares about being locked in one.