In my experience of multi-sector long-haul flights, you either HAVE to get off (EK and most other airlines at SIN, BKK en route to Aus) or you're not allowed off at all. You used to be able to stay onboard if you wanted while some pax wandered off into the duty free shops but those days seem to have passed. If it is a case of having to clear the aircraft, you also have to take all your handluggage as well, which is a HUGE pain in the arse.
PS On recent flights (ie EK DXB-SIN), business class pax (ie me) in transit didn't get access to EK's biz lounge during the ground stop, although pax joining the flight at SIN presumably waited there.
fly Saha Air 707s daily from Tehran's downtown Mehrabad to Mashhad, Kish Island and Ahwaz