My puppy can get spooked like that too, but I don't let strange dogs get that close, especially not running full speed. That sounds like it was too much for him and outside his comfort zone.
I would work with getting him neutral with dogs at a distance he can handle without panicking.
♥ Faun GSD 12-22-13
♥ Daisy Rat Terrier/Beagle Mix 3/15/02