I've heard of this happening on at least one occasion, but am pretty sure it happened more than that, causing a loss of German sailors in each (some?) scenario(s).
Do we know how U-boat captains were expected to act in this scenario, and would the allies have known about it? I imagine that various conventions probably protect the vessel lending aid, but such a ship would be a tempting target.
As an example:
When the Bismarck was sunk allied ships (notably HMS Devonshire) set about picking up survivors from the water, but soon moved off due to reports of u-boats in the area.
What I take from this is that the Royal Navy perceived that u-boat commanders would not show any mercy for ships rescuing survivors. So if u-boat commanders were given guidelines/order of conduct in such a situation the Allies were clearly unaware of it.
IMHO Its very unlikely that the u-boat commanders would be given any rules of engagement for this scenario. I'm not even sure how practical a "no fire" policy would be in this scenario.
I recall reading somewhere that on occasion u-boat commanders would sink merchant ships but allow survivors to be picked from the sea but can't give a definitive source. This is a slightly different scenario though - merchant ships did not pose an immediate threat to the u-boat, unlike a corvette or destroyer which would be radar/depth charge equipped.
If I find some good sources I'll update this thread.