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."