We compute the one-loop QCD amplitude for the process $gg\ensuremath{\rightarrow}Q\overline{Q}$ in dimensional regularization through order ${ϵ}^{2}$ in the dimensional regulator and for arbitrary quark mass values. This result is an ingredient of the next-to-next-to-leading order cross section for heavy-quark production at hadron colliders. The calculation is performed in conventional dimensional regularization using well-known reduction techniques as well as a method based on recent ideas for the functional form of one-loop integrands in four dimensions.