This answer just puts together the proofs in the chain of links starting with the one you gave and fills in some of the details from the comments.
As a lemma, let $E \subset [0,1]$ with $m(E) = 1/3$. Then since $F(x) = m([0,x]\setminus E)$ defines a continuous function $F : [0,1] \to [0,1]$ with $$F(0) = m(\{0\} \setminus E)= 0 < 1/3 < 2/3 = m([0,1] \setminus E) = F(1),$$ there's some $c$ with $m([0,c] \setminus E) = F(c) = 1/3.$ Let $A = [0,c] \setminus E$ and $B = (c,1] \setminus E$ and note that $A, B, E \subset [0,1]$ are disjoint and each has measure $1/3$. Therefore the union of any two has measure $2/3$, so by assumption,
$$\int_Ef = \frac12\left(\int_{E\cup A}f + \int_{E\cup B}f - \int_{A\cup B}f\right) = \frac12(0+0-0) = 0.$$
Therefore, we can [superficially] strengthen the assumption given in the problem to apply to any measurable set $E$ of measure $1/3$.
Now, if $m(\{f > 0\}) \geq 1/3$, then we apply the intermediate value theorem to $x \mapsto m([0,x] \cap \{f > 0\})$ to find a subset $E \subset \{f > 0\}$ with $m(E) = 1/3$. Then since $f\chi_E \geq 0$ and $\int f\chi_E = \int_E f = 0$, we find $f\chi_E = 0$, or in other words $m(E \cap \{f \neq 0\}) = 0$. However, since $E \subset \{f > 0\} \subset \{f \neq 0\}$, this implies $m(E)=0$, which contradicts the construction of $E$ as satisfying $m(E) = 1/3$. It follows that $m(\{f >0\}) < 1/3$.
Similarly, if $m(\{f < 0\}) \geq 1/3$, then we reach a contradiction in nearly the same manner, so we may also conclude $m(\{f < 0\}) < 1/3$.
Therefore $$m(\{f=0\}) = m([0,1]) - m(\{f>0\}) - m(\{f < 0\}) \geq 1 - 1/3 -1/3 = 1/3.$$
It follows that $m(\{f > 0\}) < 1/3 \leq m(\{f \geq 0\})$ so by once more using the intermediate value theorem, this time with the function $$x \mapsto m(\{f > 0\} \cup ([0,x] \cap \{f = 0\}),$$ we find a measurable set $E$ such that $\{f > 0\} \subset E \subset \{f \geq 0\}$ such that $m(E)=1/3$. As $0 \leq f\chi_{\{f > 0\}} \leq f\chi_E$ and $\int_E f = 0$, we see $f\chi_E = 0$ and hence $f\chi_{\{f > 0}\} = 0$. Therefore $m(\{f > 0\}) = 0$.
Similarly, $m(\{f < 0\}) = 0$, so $m(\{f \neq 0\}) = 0$ so $f = 0$ almost everywhere.