You were both right and wrong. I attend galas often and it was EXTREMELY rude for your dinner companions to ask about salaries. It is acceptable to ask what a person's occupation is however.
I have brought people to galas who were most definitely the poorest person in attendance. What I do is inform them as to the scope of the event. I also offer to loan them clothes if they do not have anything to wear. (I tell them that I have tons of dresses and you can never wear the same one to two different events so I do not need them. I put them in contact with my tailor if they are smaller than I am. If this will not work just make sure they know it is a formal affair.
As to what your reaction should have been, you were wrong to make a scene. You were a guest of another person and your outburst no matter what the reason, reflected poorly on the friend who invited you and yes, you could have possibly hurt that friend's business contacts. The friend will no longer be invited to events that can help their career because the host/hostess does not want drama at their event. As a result, they will not invite your friend as they have shown poor judgment as to the person they invited to be their guest.
You should NEVER make a scene at these events. If you have a problem with a person, take it up quietly or later. You NEVER CURSE!
What I would have done were I at your table is this: If I had invited my friend who is considerably poorer than the others and may not feel comfortable about discussing their job, when the subject came up I would have intercepted for him/her.
You could have said a something like:
Joe (Or whoever asked the rude question) you just want to brag to all of us about how great you are! Lets talk about something we are actually interested in! This would put the person who asked the rude question in an embarrassing situation just like he/she tried to put your friend in.
Then try to steer the conversation to a subject that you know you less-advantaged friend is knowledgeable in. If he/she is good at sports, try sports or if they paint or draw this is the ideal place to bring it up as many wealthy people are patrons of art.
Another thing to do to make your friend feel welcome depends on your own income. If you can afford it, make sure you buy a cashier's check made out to the AIDS charity from her. This way she can feel as if she is on even playing ground.
Now, as to what you should do.
Although your intentions were good you should send out a few letters of apology. You can buy a pack of Thank You cards in the Hallmark aisle at any place that carries Hallmark.
First send one to the friend who invited you. Thank them for the opportunity to attend such a lovely party. First apologize for not asking their permission in the first place to invite another guest (This is never a good idea as the host/hostess caters for a certain number of people and if everyone brings a friend, who brings a friend....You get the picture!) Then apologize for your actions. Tell them that your intentions were good as you were trying to protect the person you invited from unnecessary embarrasssment. Tell them you have also apologized to (Whoever-The person who invited them) and explained the situation. Say you hope that this will not harm your relationship or future invitations, assure them that you have learned a valuable lesson and hopefully will never embarras them again.
Then find who invited them and send them a Thank You card. Again first Thank them for the party then apologize for your actions. Tell them that you realize that it is no excuse for your actions but you were trying to protect another guest from embarrasssment created by another guest solely to embarrass them. Tell them that you hope your actions will not reflect poorly on your friend (The one who invited you) as they were not there and had nothing to do with the situation. It was entirely your fault and you now know a better way to come to the assistance of a guest in trouble and will never do something like this again.
If the party was not thrown by either person you have already written to, you should send one to them as well.
Then last but not least,
Send another letter to the friend (Cafe Worker) apologize for the actions of the others. Then apologize for your actions. Tell her that you were trying to help her and if you made things worse you are very sorry. Tell her your heart was in the right place and hopefully you can remain friends.
That should do it.
I know that your heart was in the right place you just needed more experience to know how to handle it. Just remember:
Never invite someone who was not invited to a party unless you either get their permission or if your invitation said you and "A Guest".
Never Ever make a scene during a party! Either pull a person aside (Outside) and talk to them or take it up later.
It is never a good idea to cuss at a party of any sort. You never want to embarras your host/hostess. It is also a good idea to never cuss around people you do not know. A person shows much more character to be able to tell someone off without either raising their voice or cussing (been there, Done That!)
If you see a "situation" developing that can either embarrass someone else or a cause a scene, try to run interference usually by changing the subject and getting at least one person involved in another conversation. You will become the darling of the party and everyone will want to invite you because you saved the party by avoiding a situation.
Your heart was in the right place,
Good Luck!