Police said the accident happened at 10.30pm at the Social Security Office Area 7 building on Kanchanapisek Road in Bang Bon district.
Boontham Parnngen, 50, was crushed by the 300-kilogram sliding gate, which is 2.5 metres high and six metres wide.
Another security officer, Nueng Iawthuam, said he was buying food on the opposite side of the road and saw the gate falling down and crushing his colleague.
He ran across the road and blew his whistle to call for other security guards to help but it was too late as their colleague was already dead.
Boontham's body has been sent for a post mortem at Siriraj Hospital.