I have had problems with the folding bit of the passenger mirror. Sometimes it would, sometimes it wouldn't. Sometime it would go part way. All completely random.
I bought a folding mirror from a 2003 car to fit today. I expected to just strip it and change the two coloured panels, to my surprise, the folding mirror I got did not have the memory function.
So I had to change the internal loom and motor in the mirror. I did this once before on my old car, but that had no fold and changing the loom and motor was easy. On the folding mirror, the wires go through the tube that forms the hinge of the fold. This means that all the pins in all the connectors had to be removed before threading it all through. Fourteen wires in all.
But it's done and it works.
Up to now I had tried all sorts of cleaning and lubing of the hinge to try and get the fold to work, but it was never solved. But the replacement mirror had some additional connectors in the wiring and it became clear that the electronic block in the mirror had been replaced. This got me thinking that this bit senses the current and cuts it if the mirror load is high. If I'm right, then if this goes faulty, it would give the symptoms I had - false detecting of high loads.
So if your folding mirror doesn't it may be worth finding a working mirror and just clip out that block and splice it in. I can't see it as a separate part.