trying to work out where the smoke has escaped from the electric roof circuit?
I love empirical testing and the conclusions it produces.
After a 35 year career in the electrical industry, I have to agree with you. Whenever the smoke comes out of the electrical equipment, the equipment stops working.
Go to the "Resources" section of this forum (see blue ribbon at the top of your screen). Page 1 has a couple of wiring diagrams specific to some UK Z3's. Page 2 has other wiring diagrams for the Z3. You will need to know the build date of your Z3, so you can select the correct wiring diagrams. The date range that each set of wiring diagrams covers, is on the bottom right of the first page.
The brake switch has 2 set of contacts. One for the brake lights and the other for engine computer (DME) tasks, like safety checks, cruise control operation and soft top control. So, the brake lights can still be fully functional, but the DME contact can be faulty. With a scanner, you can check the DME for fault codes. If there is a code with wording like "BTS/BLS plausibility", then this is saying that one of the brake switch contact is faulty and you have to replace the brake switch.
You've tested the micro switch, that's good work.
Another area of weakness, which may fit your problem, is that the wires that supply the micro switch travel down the left hand side of the soft top. There is a bending point at one of the joints where the wire can break inside of the insulation. It may make the circuit to begin with, but brake the circuit as the top goes down. So, test the continuity of the wires to the micro switch and back to earth by testing at the soft top switch, pin 2 of connector X13045. When the soft top stops working, test it again to see if the wiring is still good. If there is no continuity, then you have found your problem and can go searching for the wire break.
If you are still having problems, then work through the wiring diagrams for the soft top control and see what you find.