How much does non-ideal frame size matter? I have an opportunity to buy a barely-used Allez Elite for a very small amount of money (around $100). However, its frame size may be slightly different than the "ideal" size for me. If this difference in size will make the bike uncomfortable on extended rides, I'd rather purchase a different one that fits well, even for more money.

Based upon my height and leg length, I ought to be using a 55cm bike frame.

How much smaller/larger of a frame can I use before it will be uncomfortable? +/- 5cm? More? Less?
First, note that frame sizes aren't standard - you may ride a 55cm in one model, but a 52cm in another model (say, comparing road racers to cross bikes). And, you do pick your model based on preference - I prefer a larger bike than most people of my height, since I have relatively long legs and long arms. 

Most of the time, you can go about 1 frame size above or below the ideal frame size (thats around +/- 2 cm in model numbers, typically ) with part tweaking - the most important measure being top tube length, which can be drastically different between similarly labeled models (This can be offset with saddle and stem replacements to some extent, but the adjustment ability is relatively limited). This is why getting good bike fit is important (and why people have to try bikes before buying them) - the geometry chart isn't super useful unless you know how that chart fits you (and some relevant swappable parts like saddles come into play as well). Of course, you have to be careful with this, especially for bikes which will be used off road (you wouldn't want to hit the wedding jewels on the top tube for example). 

This is a good article on the topic of frame sizing. 

For what its worth, if I had to intuitively place a 55cm, 60cm, and 50 cm road bike, for males, I'd guess a 50cm being for people closer to 5'2" ish, 55cm for people closer to 5'6", and 60 cm for people who are probably 6'1" ish. But again, this is completely useless without trying the bike.

To add, most likely, a wrong frame size (or misadjusted frame) will lead to back pain or knee pain. Both are not fun to deal with once you're past being a teenager.