Basically, BMW's power windows have a "position memory," which tells them where the window should be in the opening & closing sequence. Sometimes, if that
sequence is interrupted, or if the battery is disconnected, or even for no apparent reason at all, they can simply "forget" where they are, and they need to be re-set.
Since the window action in the Z4 is tied to the top opening & closing, it seems to be a bit more prone to occasional confusion.
But the good news continues!
Barring some major mechanical malfunction, this is usually nothing that requires a trip to any dealer, nor anything more than about 30 seconds of your own time.
The following links will show you the various window initialization procedures I have seen on the web. I am listing all that I have found, since some work on some cars
and some work on others. The aim of these procedures is to reset the windows limits so that when you open the door the window will drop the 1/4 inch.