The zero-temperature single-particle Greens function of correlated fermion models with moderately large Hilbert-space dimensions can be calculated by means of Krylov-space techniques. The conventional Lanczos approach consists of finding the ground state in a first step, followed by an approximation for the resolvent of the Hamiltonian in a second step. We analyze the character of this approximation and discuss a numerically exact variant of the Lanczos method which is formulated in the time domain. This method is extended to obtain the nonequilibrium single-particle Greens function defined on the KeldyshMatsubara contour in the complex time plane which describes the systems nonperturbative response to a sudden parameter switch in the Hamiltonian. The proposed method will be important as an exact-diagonalization solver in the context of self-consistent or variational cluster-embedding schemes. For the recently developed nonequilibrium cluster-perturbation theory, we discuss its efficient implementation and demonstrate the feasibility of the Krylov-based solver. The dissipation of a strong local magnetic excitation into a non-interacting bath is considered as an example for applications.