Let $d\in\mathbb N$ and $f\in C^1(\mathbb R^d)$. Assume $\left\{\nabla f=0\right\}$ has Lebesgue measure $0$.
How can we conclude that $\left\{f\in B\right\}$ has Lebesgue measure $0$ for all Borel measurable $B\subseteq\mathbb R$ with Lebesgue measure $0$?
The claim can be found in an answer on mathoverflow.
The author writes that the claim "is true locally, in a neighborhood of each point where $\nabla f\ne0$, due to the implicit function theorem". Honestly, I don't even understand what exactly he's meaning.
Let $a\in\mathbb R^d$ with $\nabla f(a)\ne0$. Then surely, by continuity of $\nabla f$ at $a$, there is an open neighborhood $N$ of $a$ with $$\nabla f(x)\ne0\;\;\;\text{for all }x\in N\tag1.$$ But how do we need to apply the implicit function theorem and what's the resulting "local" conclusion? Maybe that $N\cap\left\{f\in B\right\}$ has Lebesgue measure $0$?
Non-singular maps. A map $f\,:\,\mathbb{R}^N\rightarrow\mathbb{R}^M$ whose inverse image preserves null-sets, -- i.e., $\mu(f^{-1}(B))=0$ for any null-set $B$, -- is often referred to as a non-singular map. The question is about showing that the class of $\mathcal{C}^1$ maps with non-singular Jacobian (or more specifically, non-zero gradient) almost everywhere is contained in the class of non-singular maps.
Let $\widetilde{N}\overset{\Delta}=\left\{\nabla f\neq 0\right\}$ (which is open).
From the IFT, we have that $\widetilde{N}\cap f^{-1}(c)$ is a (d-1)-submanifold of class $\mathcal{C}^1$.
Now, you have $\widetilde{N}\cap \left\{f\in B\right\}=\bigcup_{t\in B}\widetilde{N} \cap f^{-1}(t)$, where $\widetilde{N} \cap f^{-1}(t)$ is a null-set for all $t$ from the above remark (since it is a $\mathcal{C}^1$ submanifold from the IFT). Therefore, when $B$ is countable, the referred set is a null-set.
When $B$ is uncountable, it follows from Fubini's Theorem that $\bigcup_{t\in B}\widetilde{N}\cap B_r \cap f^{-1}(t)$ is a null-set for any bounded open ball $B_r$.
To see this latter claim, we can resort to a more specialized form of Fubini tailored to our case (referred to as co-area formula),
$\int_{\widetilde{N}\cap B_r} g\left|\nabla f\right| d\mu = \int_{\mathbb{R}} \left(\int_{f^{-1}(t)\cap\widetilde{N}\cap B_r} g(x)d\mu_{d-1}(x)\right) dt$.
Take $g$ to be the indicator of the foliation $\bigcup_{t\in B}\widetilde{N}\cap B_r \cap f^{-1}(t)$ and note that
$\int_{\mathbb{R}} \left(\int_{f^{-1}(t)\cap\widetilde{N}\cap B_r} g(x)d\mu_{d-1}(x)\right) dt=\int_{B} \left(\int_{f^{-1}(t)\cap\widetilde{N}\cap B_r} d\mu_{d-1}(x)\right) dt=0$,
where the last identity holds since $B$ is a null-set. Thus,
$\int_{\widetilde{N}\cap B_r} g\left|\nabla f\right| d\mu=0$ and therefore $g\left|\nabla f\right|=0$ almost everywhere in $\widetilde{N}\cap B_r$. Since, $\left|\nabla f\right|\neq 0$ almost everywhere, it follows that $g(x)=0$ almost everywhere in $\widetilde{N}\cap B_r$. In other words,
$\mu\left(\bigcup_{t\in B}\widetilde{N}\cap B_r \cap f^{-1}(t)\right)=\int g d\mu =0$.
Update. For the sake of completeness, I am adding the general statement.
The proof follows from the IFT and Fubini (or, more precisely, the co-area formula) just as done before.
Update 2. I am adding a Corollary.
Definition. [Null-sets on manifolds] Let $\mathcal{V}$ be a smooth manifold of dimension $d$ with smooth structure $\left\{U_{\alpha},\varphi_{\alpha}\right\}$. $A\subset \mathcal{V}$ is called a null subset of $\mathcal{V}$ if $\mu\left(\varphi_{\alpha}(U_{\alpha}\cap A)\right)=0$ for all $\alpha$.
Relevant Property. If $\mu(\widehat{A})=0$ with $\widehat{A}\subset \mathbb{R}^d$ then,
$\varphi^{-1}_{\alpha}(\widehat{A})$ is a null-set for any $\alpha$. This follows by observing that $\varphi_{\beta}\left(U_{\beta}\cap\varphi^{-1}_{\alpha}(\widehat{A})\right)=\varphi_{\beta}\circ \varphi^{-1}_{\alpha}(\widehat{A})$ is necessarily a null-set, for any $\beta$, since $\widehat{A}$ is a null-set and $\varphi_{\beta}\circ \varphi^{-1}_{\alpha}$ is a diffeomorphism -- hence, from Theorem 1, $\varphi_{\beta}\circ \varphi^{-1}_{\alpha}(\widehat{A})$ is a null-set.
In the next corollary, we assume that the manifolds admit countable atlas -- i.e., are separable.
For the proof, one just needs to notice that any local coordinate representation of $f$ fulfills the conditions of Theorem 1.