$f$ is Continuous if and only if its Graph is Closed in $X \times Y$
If you know that $\pi_X: X \times Y \to X$ is a closed map (which you seem to):
Suppose $G_f$ is closed.
Let $C \subseteq Y$ be closed. Then $G_f \cap (X \times C)$ is closed in $X \times Y$ and note that $\pi_X[G_f \cap (X \times C)] = f^{-1}[C]$ so that $f^{-1}[C]$ is closed in $X$, as $\pi_X$ is closed. So $f$ is continuous. (inverse image of closed is closed). This direction only uses compactness of $Y$.
For the other direction we only need the Hausdorffness of $Y$: The diagonal $\Delta_Y = \{(y,y) : y \in Y\} \subseteq Y \times Y$ is closed iff $Y$ is Hausdorff, and $G_f = (f \times 1_Y)^{-1}[\Delta_Y]$, where $1_Y$ is the identity on $Y$ and $f \times 1_Y : X \times Y \to Y \times Y$ defined by $(f \times 1_Y)(x,y) = (f(x), y)$ is continuous whenever $f$ is.
I think you are right. But, if you know the theory of "net", it will be more simple to prove this result. The proof is nothing but an analogue of the case that both $X$ and $Y$ are metric spaces.
Suppose that the graph is closed. Let $x_\alpha \to x$ in $X$, where $\{x_\alpha\}$ is any convergent net (not necessarily a sequence). Suppose by way of contradiction that $f(x_\alpha)\not\to f(x)$. Then there exists a neighborhood $V$ of $f(x)$ and a subnet of $\{f(x_\alpha)\}$ (which by relabeling we also denote by $\{f(x_\alpha)\}$ ) satisfying $f(x_\alpha)\not\in V$ for all $\alpha$. The compactness of Y guarantees that$\{f(x_\alpha)\}$ has a convergent subnet, which we again denote by $\{f(x_\alpha)\}$, so we may assume $f(x_\alpha)\to y$ for some $y$ in $Y$. Thus $(x_\alpha, f(x_\alpha))$ is a net in $X\times Y$ converging to $(x,y)$. The closedness of graph implies that $f(x)=y$, which contradict the condition that $f(x_\alpha)\not\in V$ for all $\alpha$.
On the other hand, suppose that $f$ is continuous and $Y$ is Hausdorff. and $(x_\alpha,f(x_\alpha))$ is a net converging to $(x,y)$. Since $f$ is continuous, we have that $f(x)=f(\lim x_\alpha)=\lim f(x_\alpha)$. On the other hand, $f(x_\alpha)\to y$. Because $Y$ is Hausdorff, $f(x)=y$.
The compactness is critical: Let $f:[0,\infty)\to [0,\infty)$ given by $f(0)=0$ and $f(x)=\frac{1}{x}$ for any $x\neq 0$. Then the graph of $f$ is closed but it is not continuous.
In response to @HennoBrandsma: Please correct me if I'm wrong, but $\pi_X$ is not closed. Let $X=[0,1]$ and $f: (0,1] \to \mathbb{R}$ be such that $f(x) = 1/x$. Then, the graph of $f$, $G(f)$ is closed in $[0,1] \times \mathbb{R}$ (it is the intersection of a closed set and $[0,1] \times \mathbb{R}$) but $\pi_X[G(f)] = (0,1]$ is not closed in $[0,1]$.