Yes it happened to me once , but at JFK ... Was on the last LHR-JFK flight and it was delayed so we had to go to T4 at JFK since immigration at the BA terminal had gone home ( it was a few years ago but I guess instead of arriving at 10:00 ish it was nearer midnight when we got there) ... I guess this must not be that unusual if that flight is late running ... I suppose that aircraft then gets towed back to the BA terminal overnight as it presumably used for the day flights back to London next day and they would need them to operate from the right terminal.