Using long-term transit timing to detect terrestrial planets