The correct statement is the following:

**Proposition.** Let $X$, $Y$ be irreducible complex spaces. Then every holomorphic, *finite* surjection $\pi \colon X \longrightarrow Y$ is an analytic (in general ramified) covering map.

For a proof of this standard result, see [Grauert-Remmert, *Coherent Analytic Sheaves*, page 179].

From the Proposition one can deduce the following

**Corollary.** Let $X$, $Y$ be irreducible, compact complex manifolds of the same dimension. Then any holomorphic, *flat* surjection $\pi \colon X \longrightarrow Y$ is an analytic covering map.

Indeed, since $\dim X = \dim Y$ one has that the dimension of the general fibre of $\pi$ is $0$, and since $\pi$ is flat *all* the fibres must have dimension $0$. Finally, $X$ and $Y$ are compact so we deduce that all the fibres are finite, hence $\pi$ is a finite map and one can apply the Proposition.

Without the flatness assumption the statement of the Corollary is clearly false, as shown by the following example. Let $X$ be the blow-up of $\mathbb{P}^2$ at a point $p$ and $\pi \colon X \longrightarrow \mathbb{P}^2$ the blow-up map. Then $\pi$ is birational, hence the general fibre consists of a single point. However, $\pi$ is not an analytic covering, since there is a fibre of dimension $1$: in fact, $\pi$ contracts the exceptional divisor $E \subset X$ to the point $p$.