We consider electrically charged static nonextremal black holes in d-dimensional Einstein-Maxwell-(A)dS gravity, whose horizon is a generic Einstein space in d − 2 dimensions. It is shown that for this system the Hamilton-Jacobi equation is exactly solvable and admits two branches of solutions. One of them exhibits a non-simply connected domain of integration constants and does not reduce to the well-known solution for the d = 4 BPS case. The principal functions generate two first order flows that are analytically different, but support the same general solution. One of the two sets of flow equations corresponds to those found by Lü, Pope and Vázquez-Poritz in hep-th/0307001 and (for d = 4 and Λ = 0) by Miller, Schalm and Weinberg in hep-th/0612308. This clarifies also the reason for the very existence of first order equations for nonextremal black holes, namely, they are just the expressions for the conjugate momenta in terms of derivatives of the principal function in a Hamilton-Jacobi formalism. In the last part of our paper we analyze how much of these integrability properties generalizes to matter-coupled N = 2, d = 4 gauged supergravity.