To understand songs from this era you have to understand the censorship of the time. Songs could not be explicit - any sexual meaning had to be very guarded and ambiguous.
So the lines
It was a very good year for city girls,
Who lived up the stairs,
establish that there was a girl who lived upstairs from him.
And then the ambiguous lines
With perfumed hair,
That came undone,
The straightforward meaning is that the girl's hair came undone, during (as it was called at that time) petting.
The more ambiguous meaning comes from the possibility in the listener's mind that the word undone applies to the girl, not the hair. With this interpretation, the lines mean that it was a very good year because he had sex with the girl upstairs.
Such subtlety is common on songs from the 1950's, and had declined markedly by the 1990's. It appears to be becoming more common in the last few years.