  Motivated by the theory of Painlev\'e equations and associated hierarchies,
we study non-autonomous Hamiltonian systems that are Frobenius integrable. We
establish sufficient conditions under which a given finite-dimensional Lie
algebra of Hamiltonian vector fields can be deformed to a time-dependent Lie
algebra of Frobenius integrable vector fields spanning the same distribution as
the original algebra. The results are applied to quasi-St\"ackel systems.
