Actually, we don't really believe that there were isolated potential wells in the early universe. We believe that structure in the universe is seeded by random quantum fluctuations. In the very early universe, we think a period of rapid expansion, called inflation , caused these quantum fluctuations to be stretched into cosmic scales.
These fluctuations in the energy density imply fluctuations in the local gravitational potential. Regions of high density generate potential wells . Regions of low density generate potential hills . This modifies the picture of acoustic oscillations to:
The analogue of compression in potential wells is rarefaction in potential hills . In the latter, gravity tries to make the fluid fall off the hill and therefore the fluid there is in an expansion phase. When we speak of compression in potential wells, you should also bear in mind that there is a correponding potential hill where the opposite is going on.