If the connection to the AP gets dropped, NM will connect to the last AP
you connected to that it can see because it attempts to preserve
connectivity. If you don't want to connect to that other network,
remove it from the saved networks list. If NM switched away from the
connection it had when you saw it, then something caused the wireless
card and driver to drop the connection to the AP, and NM was not able to
reconnect to that AP again in enough time. If your AP crashes or
reboots, for example, it might take a while to do so, during which it
can't be connected to. For example, sometimes my WRT54G crashes, and
after a reboot, the ipw2200 driver is stuck in a state where it won't
connect to the AP, requiring a module unload/reload before it can
connect again, _even_ without NetworkManager at all.
Dan