I was un both situations.

1. Was at a startup in the 2k bubble. I was apparently unofficially made lead of a project. I was in way over my head. The company was about 50 people, most from other countries like Russia and Romania.
I didn't even know what my role really meant and I struggled to learn C++ and now I was supposed to code on my own. The CTO wanted a flowchart, which I created together with the project manager, some older but nice guy from Iran.
The CTO said it was ok but too detailed.
There was a female intern doing flash. Well being an intern she couldn't pull that intro movie off and asked me for help. I had never done anything with flash and had no clue. I suggested she experimented and asked around on forums dedicated to flash movies.
One of the Russian developers was a cocky bastard. He was experienced and had created a prototype in like 2 weeks.
I felt useless, because that's what I was.
Why was I made lead for this project? Because I said that we'd get it done, despite other devs, country native, said it was hard. But I thought being optimistic was good, you can't start something and believing it won't ever get done.
Well I had an issue with my title and the Russian guy delivering and snoozing with the project manager. I felt left out, the Russian didn't respect my position and I started yelling at the morning and noon breaks.
I got mental and called in sick. A few weeks later I got fired. It was my 1st job in the IT industry, early 2000 bubble.
The company was a disaster. Open bureau with 4 people sitting on round tables 4 PCs. Wifi, computer electrosmog, no privacy, some young guy listening to loud music irritating everyone.
The "ship" had three upper etage, owner, the middle, crew, and the underground, admin hell.

All admins ever did was say no to requests for hardware and play games and chat all day.
It was funded by a prominent TV moderator's brother. In the end they spent too much on booking Reamon so they couldn't pay the bills anymore.
Funny thing when it all went downhill the "sail" outside went loose and the rats (employees like me) were leaving the sinking ship.
The investors got the hardware, the boss and his wife fled to a nearby country and sold the product to a prominent telco cashing in big time.
We sued because we didn't get our pay. We got nothing and were forced to drop the charges or else pay a big sum for the justice system.
Anyhow I was really mad at that cocky Russian guy, so that was my "manager" part in this story.

The other story is I was a contractor fixing some database import script in PHP.
In PHP warnings aren't errors.
I fixed the script but when ran it returned a warning, however doing its job.
I sent in the script and got yelled at by some guy 10 years younger than me. WTF!
Ok I did a file pointer check and did add a @ to suppress the warning. Sent in the script and never worked for this house again.
I don't need to take abuse and that's where I draw the line. Sure he was right to criticize the warning but he stepped over the line by yelling and being rude.
I didn't respond in the same way he did, but I was close to, because I don't take shit from anyone however I'm professional enough to remain civil.

The way I read this case is you both did wrong but you're a contractor and it's the way it is, you have "no rights", even if you do. You get paid way more than the employees and you're free to go if you don't like it.
You're not part of the family, you're an external asset.
It's not your job to fight or change structure. Yes, you're the Russian from my story, more talented. But just do your job and if you can't, quit or talk to the manager you have a problem with. If that leads to no result go higher but do your job. You got cocky while being in a weaker position. And you paid the price.