To describe and understand the genesis of the explosive 1988 HIV epidemic among Thai injecting drug users (IDU) in Bangkok. Two cross-sectional HIV seroprevalence sample surveys (SP-1 and SP-2) of drug users, including IDU at various stages of treatment. SP-1, a 10-week estimate of prevalence, was conducted by the Bangkok Metropolitan Administration (BMA) in their detoxification clinics from 5 January to 7 March 1988. SP-2 estimated prevalence in 1 week, 12-15 September 1988, in the same 18 BMA clinics. Both surveys included an administered questionnaire that gathered demographic and behavioral information. Analysis of HIV prevalence by clinic in both SP-1 and SP-2, and the relationships between demographic data, behavioral variables, arrest history and HIV positivity in SP-1. Data from individual clinics in SP-1 show significant increases in HIV prevalence among IDU sampled from early February 1988. Of IDU sampled in five 'early' clinics before 9 February, 2% were positive; in the 13 'late' clinics sampled from 9 February until 7 March, 27% were positive. By September 1988, however, the early and late clinics were no longer heterogeneous for HIV prevalence. For current IDU, HIV-positivity was associated with the sharing of injection equipment in SP-1 [odds ratio (OR), 1.82; 95% confidence limits (CL), 1.31-2.53] and recent jail or prison stay (OR, 2.15; 95% CL, 1.18-3.98). The behavioral factors associated with the HIV epidemic among Bangkok's IDU are similar to those described elsewhere. The monthly incidence of 5% from February to September 1988 suggests extensive needle or injection equipment sharing networks among IDU in Bangkok. Additionally, the pattern of HIV-positivity by detoxification clinic over time in early 1988, and then in September 1988 is consistent with a relationship to the prison amnesty of early December 1987. Shortly after that date, an undisclosed number of former IDU, a substantial number of whom were still injecting, and may have become HIV-positive while in custody, returned to resume injecting within existing drug-using networks throughout Bangkok and elsewhere in Thailand.