Programs like LyX use "certain" rerun statements in order to determine how many times to run the LaTeX PDF generator. This works fine with TikZ images as long as no overlays are used, but otherwise fails because there is nothing to indicate that an additional run is needed.
The problem, including a workaround and temporary solution, is described on the LyX list:
Could this (i.e. some kind of rerun statement) please be added to PGF/TikZ directly?