Here's my two cents although it's rather sketchy. For any CW complex $X$, $H^3(X;\mathbb{Z})=[X,K(\mathbb{Z},3)]$, where $K(\mathbb{Z},3)$ comes equipped with a fibration $\mathbb{CP}^\infty\to P\to K(\mathbb{Z},3)$. The total space $P$ is contractible. Now suppose $X$ is a compact manifold of dimension $n$ which is $2$-connected and $H^3(X;\mathbb{Z})=\mathbb{Z}$. Then choosing a generator of $H^3(X;\mathbb{Z})$ corresponds to a (homotopy class of) map $f:X\to K(\mathbb{Z},3)$. The pullback bundle $f^\ast P\to X$ has the property that $H^3(f^\ast P;\mathbb{Z})=0$. Since we need a finite dimensional manifold which $f^\ast P$ isn't, let $E$ denote the $(n+5)$-skeleta of $f^\ast P$. It is compact and locally looks like $X\times\mathbb{CP}^2$. I think(?) that $\pi:E\to X$ is a fibre bundle. Since $\pi_3$ is unchanged for $4$-skeleta or higher, it follows that $0=\pi_3(E)=\pi_3(f^\ast P)$, whence $H^3(E;\mathbb{Z})=0$. Feel free to tweak the answer if need be. **Edit** As pointed out by algori and Igor, the second paragraph doesn't give you a fibre bundle.