We present all relevant details of our calculation of the complete next-to-leading order O( α S 2 α) QCD corrections to heavy flavor photoproduction with longitudinally polarized point-like photons and hadrons. In particular we provide analytical results for the virtual plus soft gluon cross section. We carefully address the relevance of remaining theoretical uncertainties by varying, for instance, the factorization and renormalization scales independently. Such studies are of importance for a meaningful first direct determination of the polarized gluon density Δg from the total charm production spin asymmetry by the upcoming COMPASS experiment. It is shown that the scale uncertainty is considerably reduced in next-to-leading order, but the dependence on the charm quark mass is sizable at fixed target energies. Finally, we study several differential single-inclusive heavy quark distributions and, for the polarized HERA option, the total bottom spin asymmetry.