We present a construction of topological quantum gravity, which connects three previously unrelated areas: (1) Topological quantum field theories of the cohomological type, as developed originally by Witten; (2) the mathematical theory of the Ricci flow on Riemannian manifolds in arbitrary spacetime dimension, developed originally by Hamilton and later by Perelman in his proof of the Poincare conjecture; and (3) nonrelativistic quantum gravity of the Lifshitz type. This connection should be useful both for physics and for mathematics: It puts the mathematical literature on the Ricci flow into a new perspective using the methods of path integrals and quantum field theory, and sheds new light on puzzles of quantum gravity (spacetime topology change, short-distance completeness, etc) in a controlled setting in which many powerful theorems have been proven by the mathematicians since Perelman.