A function with countable discontinuities is Borel measurable.
Solution 1:
Let $f:[a,b]\rightarrow\mathbb{R}$ be a function with countable discontinuities, and let $c\in\mathbb{R}$. We must prove that $f^{-1}(-\infty,c)$ is measurable.
Let $A=\text{int}f^{-1}(-\infty,c)$ (the interior is taken in $[a,b]$) and $D=f^{-1}(-\infty,c)\setminus A$. Since $A$ is open, it is measurable, and since $f^{-1}(-\infty,c)=D\cup A$, it's only left for us to prove that $D$ is measurable. But notice that if $x\in D$, then $x$ is not an interior point of $f^{-1}(-\infty,c)$, that is, for every $r>0$, there exists $y$ such that $|y-x|<r$ but $f(y)\geq c$. Since $f(x)<c$, that means that $x$ is a discontinuity point of $f$. Therefore, $D$ is at most countable, hence measurable.
That argument can be used for any $f:E\subseteq\mathbb{R}^n\rightarrow\mathbb{R}$ which is Lebesgue-measurable, where $E$ is a Lebesgue-measurable subset of $\mathbb{R}^n$, and for which the set of discontinuities of $f$ has zero Lebesgue-measure.
(I'm using the following definition: a function $f:E\rightarrow\mathbb{R}$ is (Borel-)measurable iff for every $a\in\mathbb{R}$, $f^{-1}(-\infty,a)$ is a (Borel-)measurable set. It can be easily shown that any function which satisfies that condition also satisfies the following: for any Borel-measurable subset $A$ of $\mathbb{R}$, $f^{-1}(A)$ is a (Borel-)measurable subset of $E$)