I will denote the Fourier transform of a function $f(x)$ as $\mathfrak{F}(f(x))(\omega) = \widehat{f}(\omega)$, and its inverse Fourier transform as $\mathfrak{F}^{-1}(\widehat{f}(\omega)) = f(x)$.
Consider the following PDE problem with initial condition
$$ \left\{ \begin{aligned} &u_{xt} = u_{xx} \qquad && -\infty < x < \infty, t>0 \\ &u(x,0) = f(x) = \cos x \qquad && -\infty < x < \infty \end{aligned} \right. $$
Its solution can be found by taking the Fourier transform with respect to $x$ (it's just $\mathfrak{F}(u(x,t))$ keeping $t$ constant) of both sentences and solving the resulting equations. Since
$$ \begin{aligned} &\widehat{u_{xt}} = i\omega \widehat{u}_t\\ &\widehat{u_{xx}} = i^2\omega^2 \widehat{u} = -\omega^2\widehat{u}\\ \end{aligned} $$
The new set of equations becomes $$ \left\{ \begin{aligned} &\widehat{u}_{t} = i\omega \widehat{u} \qquad && -\infty < \omega < \infty, t>0 \\ &\widehat{u}(\omega,0) = \widehat{f}(\omega) \qquad && -\infty < \omega < \infty \end{aligned} \right. $$
This is a well-defined ODE problem, whose general solution is
$$ \widehat{u}(\omega,t) = C(\omega)e^{i\omega t} $$
And the coefficient $C(\omega)$ can be found from the initial condition
$$ \widehat{u}(\omega,0) = C(\omega) = \widehat{f}(\omega) $$
so the final Fourier transform of the solution is $ \widehat{u}(\omega,t) = \widehat{f}(\omega)e^{i\omega t} $. But note that
$$ \widehat{u}(\omega,t) = \widehat{f}(\omega)e^{i\omega t} = \widehat{f(x+t)} $$
The solution to te original problem is
$$u(x,t) = \mathfrak{F}^{-1}(\widehat{u}(\omega)) = \mathfrak{F}^{-1}(\widehat{f(x+t)}(\omega)) = f(x+t) $$
To reach it, however, the Fourier transform of the initial condition, $\widehat{f}(\omega)$, was considered,
$$ \widehat{f}(\omega) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty} f(x)e^{i\omega x}dx = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty} \cos (x)e^{i\omega x}dx $$
This integral does not converge, so at first instance, it shouldn't have been considered. On the other hand, that never mattered because there was no need to calculate $\widehat{f}(\omega))$ explicitly, only the general properties of $\mathfrak{F}$. In fact, the steps taken indeed led to the solution of the problem, so the method used has some merit, even though it must have exploited notation at some point.
So why did the steps taken lead to the actual solution of the given problem? When will this not work, diverging from the real solution of a PDE with initial condition?
A professor of mine suggested that the formal solution could probably be found by truncating $\mathfrak{f(x)}$ before infinity, i.e. considering the transformation
$$ \int_{-L}^L f(x)e^{-i\omega x}dx $$
with $L<\infty$, unlike the usual Fourier transform. I can't really see how this would work throughout the solution.
Please excuse me for any bad formatting, and warn me about any typo or error.
.