In a surprising reversal of earlier statements, British Prime Minister Margaret Thatcher announced her resignation this week after more than 11 years at the helm - the country's first woman prime minister and the longest-serving in that office since 1827. She will be deeply missed, not only at home, but also by the United States, for whom she was a close, always reliable friend.

Although she beat back a party revolt against her 11-year leadership earlier this week, Thatcher did not carry the day by a big enough margin to satisfy party rules and was persuaded to resign before a second vote could be held Nov. 27. While her departure may have spared the Conservative Party a bitter fight, it is by no means clear that the Tories will prosper as a result.A new party leader will be chosen by secret ballot at the November Tory meeting. Whoever leads the majority party in Parliament - in this case the Conservatives - automatically becomes prime minister.

The favorite at this point appears to be Michael Heseltine, former defense minister in Thatcher's Cabinet, who led the party revolt against his former boss and managed to weaken her to the point of resigning, though she out-polled him 55 percent to 44 percent in a vote among Conservative lawmakers.

While Thatcher has been increasingly unpopular over the years with the public - a fact that did not seem to bother her since she did not seek to court popularity - she was not voted out of office by the people. The Conservatives still hold a commanding lead in Parliament. This was a palace revolt, an inside job by unhappy members of her own Cabinet.

A strong-willed leader, Thatcher was dubbed the "Iron Lady," a term used both as a form of criticism and admiration. She knew what she wanted and did it, inevitably making enemies in the process. Nearly a dozen years of accumulated enemies, plus economic hard times at home and her skeptical and unpopular view of a united Europe finally eroded her power within the party, allowing a minority to unseat her.

Thatcher's achievements are historic. In a sense, she took an economically decaying Britain, mired in socialism and lacking national self-esteem, and turned it into a confident country, with a new sense of free enterprise and private property.

Under her rule, the excesses of trade union power were curtailed, personal wealth grew, income tax rates plunged, more than a million tenants of public housing now own their homes, individual ownership of corporate stock has soared, some $57 billion worth of state-owned companies have been sold, the nation's electricity industry is about to be privatized and London has been turned once more into a world financial center.

She sent her country into war over the Falklands, a popular step that restored to Britons a lost sense of pride in their military. And she was the first world leader to recognize that Mikhail Gorbachev was a new kind of Soviet leader, one the West could deal with.

Margaret Thatcher's name will be written large in history books. With her stepping down, an era will close. Britain was fortunate to have her as its leader all those years. In many ways, it is a better country as a result.