Theorem
Let $X$ and $Y$ two topological spaces: if $X$ is first countable and if $f:A\rightarrow Y$ is a continuous function such that $f(x)=y_0$ for any $x\notin S$ where $S$ is a closed set contained in $\overset{\,\,\circ}{A}$ then the function $F:X\rightarrow Y$ defined through the condiction $$ F(x):=\begin{cases}f(x_0)\,\,\text{if}\,x_0\in A\\y_0,\,\,\text{otherwise}\end{cases} $$
is a continuous extension of $f$ to $X$.
Before to prove this theorem we remember some fundamental results.
Lemma 1
If $X$ is first countable and if $f:X\to Y$ is a function then $y_0$ is the limit of $f$ as $x$ approaches at $x_0$ if and only if for any sequence $(x_n)_{n\in\Bbb N}$ converging to $x_0$ it happens that $\left(f(x_n)\right)_{n\in\Bbb N}$ converges to $y_0$.
Proof. See here.
Lemma 2
If $X$ is first countable and if $f:X\rightarrow Y$ is a continuous function then any sequence $(x_n)_{n\in\Bbb N}$ converges to $x_0$ if and only if the sequence $(f(x_n))_{n\in\Bbb N}$ converges to $f(x)$.
Proof. See page $71$ of "General Topology" by Stephen Willard.
Theorem 3
If $X$ is first countable and if $f:X\rightarrow Y$ if a function then it is continuous if and only if $f(x_0)$ is the limit of $f$ as $x$ approaches at $x_0$.
Proof. A simple consequence of the two preceding lemmas.
Lemma 4
If $(x_n)_{n\in\Bbb N}$ is a sequence converging to $x_0$ and if $(y_n)_{n\in\Bbb N}$ is a sequence such that $y_n=x_n$ for any $n\ge n_y$ then $(y_n)_{n\in\Bbb N}$ converges to $x_0$ too.
Proof.If $y_n=x_n$ for any $n\ge n_y$ if for any neighborhood $U$ of $x_0$ there exist $n_U$ such that $x_n\in U$ for any $n\ge n_U$ then $y_n\in U$ for any $n\ge\max\{n_y,n_U\}$ so that the lemma holds.
So now we prove the theorem:
Proof. To prove the theorem we use the theorem 3 and in particular we separately analyze the case where $x_0\in\overset{\,\,\circ}A$, the case where $x_0\in\partial A$ and the case where $x_0\in\text{ext}(A)$ since the collection $\mathcal{P}:=\{\overset{\,\,\circ}A,\,\partial A,\text{ext}(A)\}$ is a partition of $X$.
So if $x_0\in\text{ext}(A)$ then the sequence $(F(x_n))_{n\in\Bbb n}$ is semicostant (or rahter $F(x_n)=y_0$ for any $n\ge n_0$) for any sequence $(x_n)_{n\in\Bbb N}$ converging to $x_0$ so that we conclude that the function $F$ is continuous in $\text{ext}(A)$.
Since $S=\overline S\subseteq\overset{\,\,\circ}A$ then if $\overline S\cap\partial A=\emptyset$ so that for any $x_0\in\partial A$ there exist a neighborhood $U$ such that $(U\cap S)=\emptyset$ and so if $(x_n)_{n\in\Bbb n}$ is a sequence converging to $x_0$ there exist $n_0\in\Bbb N$ such that $x_n\in U$ for any $n\ge n_0$ that is $F(x_n)=y_0$ for any $n\ge n_0$ so that as above we conclude that $F$ is continuous in $\partial A$.
Finally if $(x_n)_{n\in\Bbb n}$ is a sequence converging to $x_0\in\overset{\,\,\circ}A$ then there exist $n_0\in\Bbb N$ such that $F(x_n)=f(x_n)$ for any $n\ge n_0$ and so by lemma $4$ we conclude that $F$ is continuous in $\overset{\,\,\circ}A$ too.
So the theorem holds.
Although the proof of the theorem seems correct I doubt that it is false. Indeed if $X=Y=\Bbb R$ and $f(x):=sin(\frac{1}x)$ then $A:=\Bbb R\setminus\{0\}$ and $S=\{\frac{1}{k\pi}:k\in\Bbb Z\setminus\{0\}\}$ then $$ F(x):=\begin{cases}sin(\frac{1}x)\,\,\text{if}\,x\neq 0\\0,\,\,\text{otherwise}\end{cases} $$
and this function is not continuous: any way I am not sure that $S$ is closed because it seems to me that $0\in\overline S$ and $0\notin S$. So is the theorem true? and if yes, is my proof correct? and if the theorem false is my counterexample correct? So could someone help me, please?