Police said the incident occurred at about 2:15 a.m. (1:15 GMT) while the man was being detained at the Croydon Custody Center in south London, where arrested suspects are processed.
Ratana was treated at the scene for injuries but died in hospital.
The 23-year-old suspect is thought to have then turned the gun on himself. He was taken to hospital with a gunshot wound and is in a critical condition. Officers did not open fire.
London police chief Cressida Dick described the the incident as "truly shocking" and added that based on early indications, the suspect shot himself.
The killing of an officer is a rare event in Britain where the vast majority of police remain routinely unarmed. The BBC said only 16 other London police officers had been killed by a firearm since World War Two.