Mike's example in the comments is fine, but here is a simply connected example.
Let $X$ denote the homogeneous space $U(3)/U(1)^2$ where $U(1)^2$ sits in $U(3)$ as matrices of the form $\operatorname{diag}(z,w,1)$ and let $Y$ denote $S^2\times S^5$. I claim that the cohomology rings of $X$ and $Y$ are isomorphic, but that $\pi_4$ distinguishes them.
To compute the cohomology ring of $X$, note that there is an intermediate subgroup $U(1)^2\subseteq U(2)\subseteq U(3)$ giving rise to a homogeneous fibration $$U(2)/U(1)^2\rightarrow U(3)/U(1)^2\rightarrow U(3)/U(2).$$
Using the fact that $U(2)/U(1)^2 \cong S^2$ and $U(3)/U(2) = S^5$, we see that $U(3)/U(1)^2$ has the structure of an $S^2$ bundle over $S^5$. From the Gysin sequence, this is easily enough to show that that cohomology ring of $U(3)/U(1)^2$ is isomorphic to that of $S^2\times S^5$.
Now, from the fibration $U(1)^2\rightarrow U(3)\rightarrow X$, we get an LES in homotopy groups. Since $U(1) = S^1$ has vanishing higher homotopy groups, this implies $\pi_k(X)\cong \pi_k(U(3))$ for any $k\geq 3$. Further, since $U(3)$ is diffeomorphic (but not Lie isomorphic) to $SU(3)\times S^1$, $\pi_k(X)\cong \pi_k(SU(3))$. Then, according to this paper by Mimura and Toda, $\pi_4(SU(3)) = 0$, so $\pi_4(X) = 0$.
On the other hand, $\pi_4(Y)\cong \pi_4(S^2)\times \pi_4(S^5)\cong \mathbb{Z}_2\times \{0\}$.