to be fair some pit bulls do show their teeth and snarl when they're playing. can't speak for the mouth foaming though. we have two shop dogs who are both pits and when they play fight it looks like they're trying to kill each other. it's very hard to tell that they're playing and not fighting, but neither one ever ends up with a scratch.
you have to err on the side of caution though. you have to assume the worst when you don't know the dog. glad you got away, and you should seriously consider telling the police what happened. you could be saving someone from serious injury and the dog from being put down due to its irresponsible owner.