I think you need to pick and choose what you share and how much. Telling you about the "mean girl" served no purpose at all whatsoever other than to hurt your feelings and make you angry. Better left unsaid. Telling you about the guy cursing at you on the bus is no biggie in my mind. I would probably say something to my friend about it and we would talk about "some people," etc. One is pretty benign, although I don't think I would share everything the bus-guy said if he unloaded a string of ugly words. It's one thing to say, "He called you a B, he was rude," and another, "He called you a this and that, and then he went on to say this about your pants and ugly toes..." One is just a rude guy making an ugly comment, the other is very hurtful.
I think your friend should have warned you in advance about co-worker if she knew he would be there. "Co-worker tends to do this, do that, just so you know; just be careful around this person." Given that the friend didn't know you would bump into coworker, there wasn't much that could be accomplished after the fact, and sharing these nuggets with you served no purpose.
I'm thinking what he could have said was something like, "You remember Joe? I didn't think to warn you about him because I didn't expect to run into him, but he's kind of a back-stabber, and he'll be nice to your face and then rip you to shreds behind your back. If we ever bump into him again, I just want to warn you, he is not to be trusted." No need to expand on what he said about you, and if it does slip that he talked about you, then say "Nothing horrible," or "I don't remember exactly what he said," but don't expand on it further. Does that make sense?
I had this happen to me -- so-and-so said this or told me that, and it really destroyed any relations with these people. Of course in my situation, I was with an abusive spouse, and to this day I have no idea if these people actually said these things. It was like I was being monitored and people would go to the Ex and "return and report" my every word and flaw and they hated me, even though I thought we were getting along really great and having a good time. It could be my Ex twisting everything around, like he tended to do, but in any case, it only hurt me when he spewed these things.
I guess now you know to avoid Coworker, but given the fact you will probably never see this person again, sharing with you the awful things he said was not useful at all. Some things are pretty benign and okay to share, like the stranger on the subway. You do need to be careful on how much, in any situation or how you put it, like is it constructive to change behaviors that don't mix well in a certain group, without saying, "Everyone thought you were a ..... and said .... about you".
Another most annoying thing is when certain people were talking about you, but they won't share who and they won't share what was said, which leaves you paranoid on the who's and the what's and why say anything at all? Why bother unless you're going to say specifically, So-and-so talks behind your back and you need to stay away from them. It's a fine line between knowing and not knowing and which is better? Do you want to keep being friendly with someone, oblivious to the horrible things they say about you or would you rather know? I guess it makes a difference most if you will ever see this person again, and I think I would want to know who to stay away from or keep at arm's length, but I don't know that it's necessary to share every detail on what was said specifically.