A function $f:\mathbb{R}\rightarrow\mathbb{R}$ is Lebesgue measurable if the set $\{x:f(x)<a\}$ is Lebesgue measurable for all real numbers $a$. But my question is, what if something slightly weaker is true? What if $\{x:f(x)<a\}$ is only Lebesgue measurable for almost all real numbers $a$? That is, what if the set of all real numbers $a$ such that $\{x:f(x)<a\}$ is not Lebesgue measurable has Lebesgue measure $0$? Then what can we say about $f$?
Can we say that $f$ is Lebesgue measurable, or what?
Suppose $\{x :f(x) < a\}$ is measurable for almost every real number $a$ (w.r.t. the Lebesgue measure). Then the set of such $a$ must be dense in the real line, thus for any real number $y$ we can find a sequence of such $a$, say $(a_n)$, such that $a_n \to x$ monotonically from below. Then $$ \{x : f(x) < y\} = \cup_n \{x : f(x) < a_n\}$$ and hence is measurable as a countable union of measurable sets. Thus your definition of 'almost measurable' is just equivalent to the usual definition.