In the last post I described gravity as the curvature of space, creating little wells for other masses to fall into. This is the image we want to think about as we imagine the early universe. At that time, the structure we see in the universe today hadn't formed yet - there were no planets, galaxies or clusters of galaxies. Instead, there were small perturbations, small potential wells that contained the seeds of future galaxies. Returning to the image of a bowling ball on a mattress, we can imagine a giant mattress with many small little bowling balls on it. These bowling balls were placed at random, simply because nothing is perfectly smooth. In addition to the bowling balls, there are countless smaller marbles moving at random across the surface of the mattress. None of the bowling balls was very large, but they did create small little divots for the little marbles to fall into or orbit around or bounce in and out.
This isn't the whole picture though. Over a month ago, I described the thermal equilibrium of the early universe, where everything was reacting with everything else, atoms were ionized and electrons were constantly interacting with photons. There was a lot of energy involved in those reactions. In particular, this energy was enough to keep the marbles from settling down in the divots. If too many marbles gathered in a particular place, the pressure caused by all the photons bouncing around tended to push the marbles apart. In this way, a situation very much like the pendulum on the spring was created. The marbles were attracted to the wells created by the bowling balls, but when they tried to reach the center, there was enough energy to push them back out. Once out, they were again attracted to the bottom of the well, and therefore we have an oscillation.
I've taken a nice illustration from University of Chicago Professor Wayne Hu's website. In this movie, the well is caused by the random gravitational fluctuations, or the bowling balls. The marbles are represented by the yellow balls, and the pressure caused by all the photons is represented by the springs, pushing the marbles apart when they get too close to the bottom of the well.