A relevant idea by @sure was relegated (by her/him-self!) to comments. Let me give it justice here. Actually, I'll provide a counter-example:

**TTHEOREM**   There exists a non-continuus map $\ f : X\ \rightarrow Y\ $ of a metric 1-dimensional compact **connected** space $\ X\ $ into a metric 1-dimensional separable complete space $\ Y\ $ such that the graph $\ G(f)\subseteq X\times Y\ $ is a **closed connected** subset.

**PROOF**   Let $\ X:=S^1\ $ be the unit circle in the complex plane, with center $\ 0.\ $ Let $\ Y:=\mathbb R.\ $ Define

$$\forall_{t\,:\, 0\le t< 2\cdot\pi}\ \ f\left(e^{\imath\cdot t}\right)\ :=\ \tan\left(\frac t4\right)$$

That's it, **END of Proof**.