Saichol Mailuan, 25, was arrested in Wang Noi district in possession of 1,000 speed pills, a .357 handgun, five spent shells and unfired ammunition for the revolver.
Police said Mr Saichol initially resisted arrest and fired on a team of policemen.
During the gunfight, the suspect accidentally shot himself in the left leg while the officers, who were wearing bullet-proff vests, were unharmed.
Police said the man had a criminal record, and had served five years in prison for attempted murder and drug distribution.
Mr Saichol told investigators that he was forced to sell ya ba because he needed the money to support his five wives, who all lived in different houses.
Apparently none of the five wives was aware of Saichol's marital arrangements. All arrived at the police station and, to the amusement of officers all five gave the bad boy a good slap in the face.