On the non-stationary passage through bifurcations in resonantly forced Hamiltonian oscillators