The sunroof cassette is held in by adhesive, two straps on each side welded to the car body, and several spot welds around the sides and front of the sunroof opening. The spot welds present the biggest problem as they are hard to find and you won’t know that you have missed one until the rest of the cassette is free, in which case you will probably bend he roof. You really don’t want to bend the roof (been there done that and it is a bitch to fix).
I’ve learned to simply cut that lip leaving 1/18-3/16" sticking down from the roof. That completely eliminates the spot welds. Then cut the straps on each side and only the adhesive will be holding the cassette in. If you are lucky age will have taken it’s toll on the adhesive and gentle prying will cause it to release. If not apply heat and pry.
This is pretty easy to do with no cage in the way. But with a cage in the car, getting to the side side straps will be difficult. I’d be sorely tempted to saw through the roof to cut the straps and then weld up the cuts. And then once the cassette is free you’ll have to cut it into sections to get it out of the car.
I like to skin and weld in the sunroof panel. To accomplish that I wrap the area where the gasket was with 1/18" steel rod as a filler, holding it on with tack welds. The top of the rod wants to be just slightly the upper surface of the panel. Then I remove the inner skin. With a helper on one side of the car holding that side of the panel flush I align one corner and tack it, then do the other corner. I then move to the other side of the car and tack those corners. The tack welds go from the filler rod to the roof and will mostly be below the surface of the roof.
If all went well, the panel will wind up flush with the roof all around. If not cut the errant tack weld, realign, and weld. Place tack welds every inch or so around the seam (from the panel to the rod and from the rod to the roof). When welding don’t work your way around the seam, but rather skip all over until all the welds are in place to avoid heat distortion. Grind down any protruding weld beads and fill the gap. To fill the gap I wrap tape around the seam inside of the car to form a dam for the filler. I fill the gap with metal filled body filler. It won’t absorb water and cause rusting under the paint and it is stronger and less likely to crank than bondo. Finish flush with body filler, sand, paint, and it will be as if the car never had a sunroof (from the outside).
It will be a little while, but I’m going to do this on the spare car and probably on the 325is I’m restoring. Maybe I’ll remember to document the process with pictures.