Methods and compositions are provided for efficiently preparing and manufacturing pentostatin. Also provided are novel precursors of pentostatin, pentostatin analogs and derivatives. In one aspect of the invention, a method is provided for total chemical synthesis of pentostatin via a route of heterocyclic ring expansion. For example, a heterocyclic pharmaceutical intermediate for drugs such as pentostatin, e.g., the diazepinone precursor, can be obtained efficiently through a ring expansion of an O-C-N functionality in a hypoxanthine or 2-deoxyinosine derivative. The methods and compositions can also be used to synthesize and manufacture heterocyclic compounds other than pentostatin, especially pharmaceutically important heterocyclic compounds.