In this work, we introduce a new realization of exactly-solvable time-dependent Hamiltonians based on the solutions of the fourth Painlevé and the Ermakov equations. The latter is achieved by introducing a shape-invariant condition between an unknown quantum invariant and a set of third-order intertwining operators with time-dependent coefficients. The new quantum invariant is constructed by adding a deformation term to the well-known parametric oscillator invariant. Such a deformation depends explicitly on time through the solutions of the Ermakov equation, which ensures the regularity of the new time-dependent potential of the Hamiltonian at each time. On the other hand, with the aid of the proper reparametrization, the fourth Painlevé equation appears, the parameters of which dictate the spectral behavior of the quantum invariant. In particular, the eigenfunctions of the third-order ladder operators lead to several sequences of solutions to the Schrödinger equation, determined in terms of the solutions of a Riccati equation, Okamoto polynomials, or nonlinear bound states of the derivative nonlinear Schrödinger equation. Remarkably, it is noticed that the solutions in terms of the nonlinear bound states lead to a quantum invariant with equidistant eigenvalues, which contains both an (N+1)-dimensional and an infinite sequence of eigenfunctions. The resulting family of time-dependent Hamiltonians is such that, to the authors' knowledge, have been unnoticed in the literature of stationary and nonstationary systems.