Before Shia LaBeouf got arrested and thrown out of a Broadway show ... he argued with a homeless guy on the streets of New York ... over a hat.
According to an eyewitness, a few hours before his arrest ... Shia confronted a homeless guy on the street. It appeared to the witness as if Shia thought the hat was his and Shia was trying to get it back.
You can see in the photos ... Shia is chasing after the homeless guy as he runs around holding the hat.
The eye witness tells TMZ, Shia was acting as if he knew the guy, but Shia seemed "whacked out" and was making no sense. The witness claims Shia kept saying, "It's me, Shia."
Screamed During Show ...
'Do You Know Who the F*** I Am?'
Shia LaBeouf went ballistic when confronted by security of a Broadway show Thursday night, hurling expletives and screaming everyone's favorite Hollywood phrase, "Do you know who the f*** I am?"
According to the criminal complaint, LaBeouf stood up in the middle of "Cabaret" and was yelling loudly at the actors on stage, disrupting the performance.
When security confronted LaBeouf in an effort to remove him from the theater, he screamed, "F*** you. This is f***ing bullshit. Do you know my life? Do you know who the f*** I am? Do you know who I am?"
According to the complaint, once he was brought into the station for processing, LaBeouf spit at a police officer ... landing at the officer's feet.
Thrown Out of Studio 54
Shia LaBeouf was ARRESTED after acting crazy in a New York City club, then threatening cops and club security.
Shia was at a showing of "Cabaret" at the legendary Studio 54 Thursday night ... when he was smoking inside -- which is against the law -- and "alarming people" by his conduct by being extremely loud and obscene.
Witnesses say Shia appeared extremely drunk, reportedly played grab ass with some of the actors on stage and then flew into a rage, spitting on people.
As for the threats to law enforcement ... Shia reportedly told police, "I'll f*** you up."
Police came and arrested the actor and took him to the cop shop. Shia was charged with criminal trespass and disorderly conduct.
Shia pled not guilty Friday morning and left the courthouse a free man.
Regrets ... He Had a Few
Shia LaBeouf looked like crap as he left the courthouse Friday ... after being arrested for essentially going insane inside Studio 54 in NYC.
Shia had remorse and hangover written all over his face as he walked away, just having pled not guilty to criminal trespass and disorderly conduct.
Shia allegedly threatened cops, yelled obscenities at patrons inside the club and disrupted the performance. He also gabbed an ass or 2 during his drunken tirade.
Witnesses say the actor was acting bizarre the entire evening and looked dirty and unkempt.