* ANC hails scandal-plagued president's decision to quit
* Ramaphosa due to be elected president on Thursday
* Police arrest eight in influence-peddling inquiry
* Rand soars to near 3-year high against dollar (Adds Zuma letter, Moody's, stocks, police making arrests)
CAPE TOWN, Feb 15 (Reuters) - Cyril Ramaphosa is to be confirmed as South Africa's president in a parliamentary vote on Thursday after scandal-ridden Jacob Zuma reluctantly resigned on orders from the ruling African National Congress.
South Africa's main stock market index jumped nearly 4 percent, putting it on track for its biggest one-day gain in more than two years as investors welcomed Zuma's resignation after nine years in office plagued by corruption allegations.
The rand, which has gained ground whenever Zuma hit political turbulence, soared to a near three-year high against the dollar on word of his resignation.
But the road back to prosperity and self-respect under Ramaphosa, who became ANC head in December, will be long and hard in a nation still polarised by race and inequality more than two decades after the end of white-minority rule.
Still, Zuma's departure late on Wednesday provided evidence of the strength of South Africa's democratic institutions, from the courts to the media and the constitution.
Ramaphosa was due to be confirmed as Zuma's permanent successor by parliament at 2 p.m. (1200 GMT), according to ANC chief whip Jackson Mthembu.
The 75-year-old Zuma said in a 30-minute farewell address to the nation he disagreed with the way the ANC had thrust him towards an early exit after Ramaphosa replaced him as party president, but would accept its orders.
"Defiant in defeat" and "Going, Going, Gone" were among the newspaper headlines that captured Zuma's reluctance to leave.
"South Africa's long nightmare is over," read the headline from online political news website Daily Maverick.
The foundation set up to guard the legacy of the late anti-apartheid icon Nelson Mandela said Zuma's departure brought to an end "a painful era for the country".
Parliament Speaker Baleka Mbete said she had received Zuma's resignation letter, while the ANC hailed Zuma's decision to step down.
Julius Malema, leader of the far-left Economic Freedom Fighters (EFF), said his party would not take part in the election of a new president so as not to legitimise an ANC candidate. The EFF had sponsored a no-confidence motion in Zuma that would have gone ahead on Thursday had Zuma not jumped.
Ratings agency Moody's said it was closely monitoring developments in South Africa, focusing on the policy implications of Zuma's exit.
The appointment of Ramaphosa, who will be president until elections next year, appeared certain as the ANC holds a majority in parliament, though lawmakers will hold a secret ballot if he is not the sole candidate.
"The office of the chief justice has made itself available today to officiate in the business of electing a new president," Mthembu told a parliamentary committee meeting.
Ramaphosa's first state of the nation address was expected to take place on Friday. The speech had been scheduled to be delivered by Zuma last Thursday but was postponed after pressure mounted for him to resign.
"One chapter in South Africa's political soap opera has finally ended with the resignation last night of President Jacob Zuma," NKC African Economics analysts wrote in a note.
"It would be gratifying to see the dedication and purpose the ANC put into ridding itself of Zuma now be directed into rebuilding the economy, dealing with the corruption still residing in the ANC and improving its shoddy governance record."
Zuma bowed out hours after police raided the luxury home of the Gupta family, Indian-born billionaire allies of the former president who have been at the centre of corruption allegations against Zuma and his circle for years.
Zuma and the Guptas have always denied wrongdoing.
Police said officers had arrested eight people so far in its investigations into high-level influence-peddling revolving around the Gupta family.
State broadcaster SABC said a Gupta family member was among those detained, while a senior judicial source said police were expected to arrest up to seven more people and that Gupta family members would be among them.
Police said the raid was in connection with a state-funded dairy farm, which prosecutors last month called a "scheme designed to defraud and steal".
The suspects were expected to appear in court on Thursday. (Additional reporting by Ed Cropley and Olivia Kumwenda-Mtambo in Johannesburg and Siphiwe Sibeko in Bloemfontein; Editing by James Macharia and Mark Heinrich)