RAF Coastal Command
used them in the anti-submarine role, once the RAF realised they didn't want to use them for their intended purpose, roughly 40 B-17Es were transferred to the Command as Fortress IIAs.
I daresay you could strafe a submarine on your way past it but it's not really the same as what you're asking; a B-17 low enough to strafe would get all manner of sh*t thrown at it and would be neither fast enough nor agile enough to dodge any of it, relying on its structural strength to get it out the other side would be a tall order on the crew.