Example of a non measurable function! Can we have a measurable function $f$, whose inverse is not measurable?
 A: My previous answer is wrong.
Take $f(x) = x$ ($f: \mathbb{R} \to \mathbb{R}$) where the domain has the Borel $\sigma$-algebra and the range the trivial $\sigma$-algebra. Then $f$ is clearly measurable but $f$ maps for example $[0,1]$ to $[0,1]$ which is not measurable.
Or do you want both $\sigma$-algebra's to be Borel? In that case I should modify my first answer (which was wrong because not every subset of a measure zero set is Borel measurable).
Another idea would be the following (based on the one below me): 
Let $g:[0,1] \to \mathbb{R}$ be the Cantor function. Extend it to all of $\mathbb{R}$ by defining $g(x) = 0$ for $x < 0$ and $g(x) = 1$. Now define $h(x) = x + g(x)$ (this is standard), this function has a lot of nice properties like: $h$ is a bijection and measure of $h(C) = 1$ where $C$ is the Cantor set.
Now we know that a set of positive measure contains a non-measurable subset. So let $A$ be an non-measurable subset of $h(C)$. So $M = h^{-1}(A)$ is a subset of the Cantor set and has thus zero Lebesgue measure.
So define $u := h^{-1}$. This function is measurable (Lebesgue/Borel). But $u^{-1}(M) = A$ is non-measurable.
A: I think I have an answer that works now.
Obviously the problem is trivial if we allow $f$ to be any function between measure spaces (just take the domain to have its powerset as $\sigma$-algebra and/or the trivial $\sigma$-algebra on the codomain), so this must be a question about real functions and the Lebesgue measure. 
Let $X$ be the Cantor set, $Y$ a nonmeasureable set (and hence uncountable) contained in $[0,1]$ and $g: X \to Y$ be any bijective function. Then define 
$$f(x) = \begin{cases}
  g(x) & \text{if } x \in X \\
  e^x + 2 & \text{otherwise.}
\end{cases}$$
Now let $U$ be any measurable set and let us show that $f^{-1}(U)$ is measurable. If $U \cap Y = \emptyset$ then $f^{-1}(U) \subset \mathbb{R} \setminus X$ on which $f$ is continuous. In particular $f^{-1}(U)$ must be measurable. If $U \cap Y \neq \emptyset$ then we split into two more cases. First consider the possibility that $U \cap (2,\infty) = \emptyset$. Then $f^{-1}(U) \subset X$, i.e. it is a null set and hence Lebesgue measurable. And if $U \cap (2,\infty) \neq \emptyset$ then by a similar argument we see that $f^{-1}(U)$ is the disjoint union of a null set contained in $X$ and a measurable subset of $\mathbb{R}\setminus X$. 
Thus $f$ is measurable, but its inverse is obviously not measurable since $(f^{-1})^{-1}(X) = f(X) = Y$.
Now if we also require $f$ to be bijective rather than just injective, then I don't know the answer. It seems much harder to construct an example in that case.
