Hi and welcome to the forum. So have you checked for ghosts under the hood? Just kidding!! With out see the cars and looking at what happens I can only give you some suggests based on what I know about the windows and sun roof circuits.
We have in our cars a Control Module that handles the windows, and is know to have problems by opening and closing windows (It handles the one touch all the way down and up). Just for info the two front windows have relays built into the Control Module. However the two rears are located out side of the control module.
Control Module is located behind the glove box. You should get one from a scrap yard and replace to check out if this fixes your problem.
I also have a link for a person who may be able to help who works on the modules. His name is Scott Johnson, and let him know that you got this info from me and the forum.
His web site
http://www.bmwgm5.com/ is for newer models but he knows what he is doing.
The sun roof has a separate switch and control in the roof with the motor. It has a comfort relay that is under the drivers side dash. So we should have no tied connection between windows and sun roof? So would have to see the car to be able to give any advise on the two working together.
Hope this helps