MIA Terminal D is linked with Terminal A but it's long walk through a series of winding labyrinthine concourses. Takes a good ten minutes at a swift pace but worthwhile if you have more than an hour to kill.
At LHR, you can opt to visit either the CX or AA lounge or both.
Oh, and a warm welcome to FlyerTalk