I suppose you could knock out a merchant's guns if you were lucky. Might be easier to do with the smaller rapid-fire AA guns than the big one. However, in reality even the small possibility of taking a hole to the pressure hull and unnecessary crew causalities in return would dissuade most skippers. We do tend to like to things in the game that were unpracitical in real life due to the risk factor. A submarine was never built to be a gunboat and even with the mods the game is still too generous in regards to what poor gun platforms they actually were.
As for trying to silence an escort's guns...forget it.