THE failed Moscow coup and the subsequent upheavals in the Soviet Union inevitably eclipsed most other news stories. Less than a month ago, however, the events dominating the headlines were the release of two Western hostages in Lebanon and what looked like progress toward the freeing of all detainees in the Middle East.If it has slipped from sight, the hostage issue must not slip from mind. Public hopes and expectancies are no small force in the process to bring about the release of all those - Westerners, Arabs, and, it seems, at least one Israeli - held against their will as political pawns. The release last month of John McCarthy of Britain and Edward Austin Tracy of the United States did not presage, as many people hoped, a comprehensive settlement of the hostage issue - not in the short run, anyway. It's evident that what then looked like a process that might culminate in days or weeks still requires many months of patient, painstaking negotiation. Still, dynamics in the region seem to favor freedom for the hostages, sooner rather than later. The trip of United Nations Secretary-General Javier Perez de Cuellar to Geneva last month to help mediate the hostage negotiations didn't bear immediate fruit, but he has remained engaged in the process. A UN special envoy has held talks with Iranian officials in Tehran on the issue. Tehran holds the key to breaking the stalemate. Iran and the hostage-takers insist that no more Westerners will be freed until Israel releases thousands of Palestinian detainees in southern Lebanon, while Israel refuses to relinquish Arabs it holds without a full accounting for seven missing Israeli soldiers, at least one of whom is thought to be alive. Although it probably does not directly control the radical hostage-taking groups, Iran, more than any other party, can soften those groups' attitudes on the Western hostages and the missing Israelis. Some in Tehran still regard the hostage issue as a useful wild card in their diplomacy, but others, including President Rafsanjani, recognize that Iran can never achieve a productive opening to the West so long as the crisis is unresolved. That view seems to be inching toward ascendancy.