Coming to all stop when setting speed to Flank is a SH3 Malfunction I have had before. Sounds like it might be the case.
It really is a sound move to run through everything when you leave port. Test all the speeds, diving and surfacing, the guns, etc. They aren't the sort of things you want to find out about in the heat of battle.
I know you say you think you must have used Flank before then, but if you test everything you won't have to think, you'll know.
Nice job getting out of that tight spot, by the way.