I have an idea, but (UPDATE) with a gap:
Note that $f:X-\{a\}\to f(X-\{a\})$ is biholomorphic.
Let $\phi: U \to D$ be a chart from $U\subseteq X$ to the unit disc $D$ such that $a\in U$ and $\phi(a)=0$. Then $\psi:f(U-\{a\})\to D^\times$ defined by $\psi=\phi\circ f^{-1}$ is a biholomorphism from $f(U-\{a\})$ to the punctured unit disc. Define the sequence $z_n:=\frac{1}{1+n}$ in $D^\times$. Since $Y$ is compact, the sequence $\psi^{-1}(z_n)$ has a convergent subsequence with limit point $b$.
Here's the gap: I want to argue that $V:=f(U-\{a\})\cup\{b\}$ is open. Intuitively, $b$ fills the puncture in the open set $f(U-\{a\})$, just as zero fills the puncture in $D^\times$. However I struggle to translate that thought to topology.
If we assume it is true, then $\psi$ is a bounded holomorphic function on $V-\{b\}$ and thus, by the removable singularity theorem, $\psi$ can be extended to a holomorphic function on the open set $V$. In order for the map to be continuous, $b$ must be sent to zero: $\overline{\psi}:V\to D$ with $\overline{\psi}(b)=0$.
From then on, it would be simple: $\overline{\psi}^{-1}\circ \phi$ is a biholomorphism between $U$ and $V$. Hence the mapping $$F:X\to f(X-\{a\})\cup\{b\},\quad x\mapsto\begin{cases}f(x), & x\neq a\\ (\overline{\psi}^{-1}\circ \phi)(a)=b,& x=a\end{cases}$$ is biholomorphic. Since $X$ is compact and open, $F(X)=f(X-\{a\})\cup\{b\}$ is compact and open in $Y$, which is only possible if $F(X)=Y$.
However, we really only need the existence of $b$.
– mgns Feb 06 '22 at 17:29Let $X$ be a Riemann surface, $U\subseteq X$ an open subset and $a\in U$. Let $f:{U-{a}}\to {\mathbb{C}}$ be a holomorphic function. If there is a neighborhood $T\subseteq U$ of $a$ such that $f$ is bounded on $T-{a}$, then there exists a unique holomorphic function ${g}:{U}\to {\mathbb{C}}$ with ${g}|_{U-{a}}=f$.
– mgns Feb 06 '22 at 17:32