I think Angelo is right in broad strokes.  For minor errors it's annoying to bother the editor and the referee. But if it's something that the referee might end up wasting hours on then correcting it pre-emptively makes sense.  Here are some examples of things that I'd wait or not on for concreteness.  I'd love to hear from people with more knowledge/experience about whether this is vaguely the right place to draw the line.

Wait:
1) An example is incorrect
2) A table has some wrong entries
3) A technical assumption is missing in the statement of a lemma, but everywhere the lemma is used the assumption holds
4) You say something's you've constructed is unique, but really it's only unique up to complex conjugation.
5) You're proving some result subject to several technical assumptions, turns out you forgot to include a technical assumption that's no worse than the others.

Contact immediately:
1) A result (not just a lemma) in the paper is completely wrong
2) A result in the paper may be correct, but the proof is unfixable
3) A section needs to be removed or added
4) A construction you use doesn't work, it needs to be replaced by a rather different construction.