This won't be the most rigorous answer, but just a representation my intuition with regards to the Fourier transform.
In nonrelativistic quantum mechanics there are two important operators which act on $L^2(\mathbb{R})$.
The position operator,
$$ (\hat{x} \psi)(x) = x\psi(x),$$
and the momentum operator,
$$ (\hat{p} \psi)(x) = -i \frac{\partial \psi}{\partial x} (x).$$
Now the "eigenvectors" of $\hat{x}$ are $a_{x'}(x) = \delta(x-x')$ and the "eigenvectors" of $\hat{p}$ are $b_p(x) = e^{ipx}$.
Now if you study linear algebra at all you know that the choice of basis is arbitrary. Also you would know that the eigenvectors of a Hermitian operator always form a complete basis. Although our operators our Hermitian, their eigen-functions certainly don't live in $L^2(\mathbb{R})$. I'm going to completely ignore that fact and pretend that I can use them as basis.
For instance the expansion of $\psi(x)$ in terms of $a_x$'s will be,
$$ \psi(x) = \int \mathrm dx'\ c(x') a_{x'}(x),$$
we can use what we know about delta functions to conclude that the appropiate expansion coefficients, $c(x')$, are in fact $c(x')=\psi(x')$.
If we want to expand $\psi$ in the momentum basis (the $b_p$'s) then we write the superposition and try to determine the coefficients.
$$\boxed{ \psi(x) = \int \mathrm dp \ c(p) b_{p}(x)},$$
the coefficient function, $c(p)$, is a vector in $L^2(\mathbb{R})$ as well. In fact what we have writtend down here is an isomorphism between the x-basis and the p-basis. However the bahavior of the operators on functions expressed in this new bases is different.
$$ \hat{x} \psi(x) = \int \mathrm dp \ c(p) x e^{ipx} = \int \mathrm dp \ c(p) \left(-i\frac{\partial}{\partial p} \right)e^{ipx} = \int \mathrm dp \ i \frac{\partial c(p)}{\partial p} e^{ipx} $$
$$ \boxed{ \hat{x} = i \frac{\partial}{\partial p}} $$
$$ \hat{p} \psi(x) = \int \mathrm dp \ c(p) \left(-i \frac{\partial}{\partial x} \right) e^{ipx} = \int \mathrm dp \ c(p) p e^{ipx} = \int \mathrm dp \ i \frac{\partial c(p)}{\partial p} e^{ipx} $$
$$ \boxed{ \hat{p} = p} $$
This means that in the p-basis the eigenvalues of $\hat{x}$ are $a_x(p) = e^{-ipx}$. I can write $c(p)$ in terms of the x-basis then by the integral,
$$ c(p) = \int \mathrm dx \ \phi(x) e^{-ipx} $$
I've used $\phi(x)$ to represent the coefficients in this expansion, but in practice we actually know the vector in the x-basis which is isomorphic to $c$, that would be $\psi(x)$.
$$ \boxed{ c(p) = \int \mathrm dx \ \psi(x) e^{-ipx} }$$
One issue is the normalization of the transforms are off. This is because the don't have finite norms. For that you need to actually prove the Fourier inversion theorem.
Best Answer
Jonas T already hit on the important point that for the first integral to be defined, $f$ must be in $L^1$. Similarly, for the second integral to be defined, $\hat{f}$ must be in $L^1$.
Fabian has mentioned that the Fourier tranform can be generalized even beyond $L^2$. But if you're only concerned with $L^2$, then one way to define the Fourier transform is to first show that it defines an isometric (with respect to the $L^2$ norm) isomorphism on the Schwartz space, which is dense in $L^2$, and then take the unique extension to all of $L^2$. The fact that the Fourier transform defines an isometry with dense range on a dense subspace of $L^2$, and thus has a unique extension to a unitary operator on $L^2$, is known as Plancherel's theorem. I have only mentioned one approach, which is the one I learned from Chapter 10 of J.B. Conway's A course in functional analysis.
So the answer to your final question, at least restricted to $L^2$, is that every element of $L^2\setminus L^1$ provides an example, strictly speaking. However, you can show that $\frac{1}{\sqrt{2\pi}}\int_{-R}^R f(x)e^{-i\omega x}dx$ converges to $\hat{f}(\omega)$ in $L^2$ norm as $R\to\infty$, and similarly $\frac{1}{\sqrt{2\pi}}\int_{-R}^R \hat{f}(\omega)e^{i\omega x}dx$ converges to $f(x)$ in $L^2$ norm as $R\to\infty$. I don't have a reference to a proof handy, but this and more is summarized in the Springer online encyclopedia's article on the Fourier transform, which includes helpful references and links.