First, let's make sure you understand the Fourier transform of a cosine. Start with the Euler identity:
$$e^{j\omega t} = \cos(\omega t) + j\sin(\omega t)$$
$$e^{j(-\omega t)} = e^{-j\omega t} = \cos(-\omega t) + j\sin(-\omega t) = \cos(\omega t) - j\sin(\omega t)$$
If you want to make a cosine out of complex exponentials, you need to get rid of the sine components:
$$\frac 1 2 (e^{j\omega t} + e^{-j\omega t}) = \frac 1 2 \big (\cos(\omega t) + j\sin(\omega t) + \cos(\omega t) - j\sin(\omega t) \big ) = \cos(\omega t)$$
Why do we want care about that? Because complex exponentials are the basis of the frequency domain! Each point of the Fourier transform represents a single complex exponential's magnitude and phase. A cosine is made of exactly two complex exponentials, so we'd expect there to be two non-zero points on the Fourier transform. That's what the delta functions are.
Mathematically, the Dirac delta function is a strange thing. It's defined only by its integral:
$$\int_a^b {\delta(x - c) dx} = \begin{cases}
1, & a < c < b \\
0, & \text{otherwise}
\end{cases}$$
$$\int_{-\infty}^{\infty} {f(t) \delta(x - c) dx} = f(c)$$
In other words, there's a "spike" at \$x = c\$, and the area under the "spike" is 1. This is sloppy math, but mathematicians prefer not to call the delta function a function at all, so let's not get too hung up on formalities. We have enough problems. :-)
It's easy enough to see how the delta function works with the inverse Fourier transform:
$$x(t) = \cos(\omega_0 t)$$
$$X(\omega) = \pi \big( \delta(\omega - \omega_0) + \delta(\omega + \omega_0) \big)$$
$$\begin{align}
\mathcal{F}^{-1}\{X(\omega)\} = & \frac 1 {2\pi} \int_{-\infty}^{\infty} X(\omega) e^{j\omega t} d\omega \\
& = \frac 1 {2\pi} \big(\int_{-\infty}^{\infty} \pi\delta(\omega - \omega_0) e^{j\omega t} d\omega + \int_{-\infty}^{\infty} \pi\delta(\omega + \omega_0) e^{j\omega t} d\omega \big) \\
& = \frac 1 2 \big( e^{j\omega_0 t} + e^{-j\omega_0 t}\big) \\
& = \cos(\omega_0 t)
\end{align}$$
But what does all this mean? It turns out that the Fourier transform is actually very similar to taking the dot product of two vectors. The "vectors" in this case are the function \$x(t)\$ and the "unit vector" \$e^{j\omega t}\$. You've probably seen the dot product defined like this before:
$$\overline A \cdot \overline B = \sum_i A_iB_i = A_xB_x + A_yB_y + A_zB_z$$
If you want to get a single component, you dot the vector with a unit vector:
$$\overline A \cdot \hat k = A_z$$
Well, the math is a lot more complicated, and you have an infinite number of components ("dimensions") instead of three, but otherwise that's exactly what this formula is doing:
$$X(\omega_0) = \overline{x(t)} \cdot \widehat{e^{j\omega_0 t}} = \int_{-\infty}^{\infty} x(t) e^{-j\omega_0 t} dt$$
We change the sum to an integral, the vectors to continuous functions, and (for some reason) take the complex conjugate of the second vector. Poof! Dot product. Pretty neat, huh?
So how do you do the inverse transform? Multiply each component by the unit vector, then add them!
$$\overline A = \sum_i A_i \hat e_i = A_x \hat i + A_y \hat j + A_z \hat k$$
$$x(t) = \sum_\omega X(w) \widehat {e^{j\omega t}} = \frac 1 {2\pi} \int_{-\infty}^\infty X(\omega) e^{j\omega t}d\omega$$
We made the same changes as before -- sum to integral and vectors to functions. The factor of \$2\pi\$ is there because of the complex exponentials, but it's not important.
In this context, a Dirac delta function represents a single component of a function. As a rule of thumb, when you go continuous, you start having to work with infinitesimal quantities. This is no exception.