An update from me here.
I was feeling brave and thought I'd have a go at this. So I managed to get the whole mirror unit off. I then soaked it in very hot water. Next step I managed to get the existing glass out without breaking it. Next step was removing the coloured cover and that came off ok.
After that it was a case of unscrewing everything I could find until I got to the motor. Eventually managed to pull the motor out and found the broken cog. After that put it all back together without the motor. Re-installed everything and back on the car. So glass mirror can still be adjusted but have lost the power fold of course. Not too bothered about that on the passenger side. The mirror does have say an inch of slack movement forward and back now, well since it broke, so will live with that unless it starts to move when driving.
I'm no DIY expert but having spent say 3 hours in total (it would be quicker 2nd time of course!) and all the way half expecting something to break I'd generally not recommend it unless you're feeling brave. Although to a certain extent there's not much to lose as it's already broken of course!
The instructions here were quite useful:
https://www.justanswer.com/mazda/8iqvv-mazda-cx5-replace-drivers-side-mirror-housing.htmlOne thing I did that was different was to remove the coloured cover I pushed the clips out from the inside. These can be accessed once the glass has been removed. It appeared to be impossible to do any other way. Even then it was a pain. I used to tiny screwdrivers to push and wedge as many clips in one go as I could.
Other thing - when removing the door cards about half of them broke. that may have been me being ham-fisted but cheap enough to get some replacements anyway so not too bad.