I was thinking you might need it to seal behind the side mirror with the silicone, there are holes behind there. I would be putting it on both sides of the 'foam' things you described so it's stuck to the mirror on one side and stuck to the car door (not the glass) on the other side. If that foam is not sitting tight against the back of the mirror water could come in where the wire goes through the door, so you seal around the O in the foam where the wire goes through. Those foam things can sit pretty awkwardly some times.
But honestly, having now seen the photo's, those glass seals need a good clean my friend, as previously described. Look at them, there's green moss growing in there. That stuff will grow and will lift the seal off the glass, seriously. They need a blade running down the glass and they need a scrub with running water to wash the moss away, just like in the video I attached earlier, or with a tooth brush or something similar. I'm sorry if it doesn't solve your current issue and you waste more time but if you take it to a garage a bit of cleaning becomes expensive and it should be something they do to eliminate it as the cause of the leak.
You're not necessarily going to find a big visible gap that you can stick your finger in to see if the leak stops, it's going to be tiny break in a seal that might not be obvious. So clean the seal surfaces and then silcone anything you can that's out of sight behind the mirror. Or take it to a garage and see what they say, at least you can tell them it's happening some where around the area of the mirror.