The best advice I can give about being pinged (early war, mind you) is to go to flank speed and present the smallest angle you can towards the DD pinging you. You can go to flank speed for a few seconds in order to get your ass-end towards the DD, as they can't use their hydrophones when pinging...don't worry about your "stealth meter" turning red while doing this. Once you get your butt towards them and you go back to slow speed, it'll quickly go back to green. Just make sure that you don't go any more than 2 knots (unless you're pulling an evasion move as described above) and try to get to at least 100 meters deep and you shouldn't have any problems in early war.
After late '41/early '42...well, the rules change. I'll let you figure that out for yourself.