For example if I run this from Preview, the first time it will print 1, but the second time it will return 0. Running it for the third time it returns 1 again (basically it works as expected every odd time). I thought arrays do not keep their contents if they are not set to "Persistent"?

Persistent only means that the content will be stored on file (both in the zgeproj and the final executable). I guess it could be cleared when stopping designer, but the current behaviour is the same with Variables (they are not reset between preview runs).