Ex-Republic of Ireland boss O'Neill was brought in to replace Aitor Karanka who left the club in January, and along with his assistant Roy Keane led the team to a ninth-place finish in the Championship.
Keane left the club last week to seek a manager's job of his own, and now his former boss has followed him out of the door at the City Ground on a hectic afternoon during which the club announced almost immediately that Lamouchi will take over for next season.
He led the Ivory Coast in their World Cup campaign in Brazil in 2014, going out at the group stage when a last-minute penalty for Greece condemned them to a third-place finish and a third consecutive group-stage exit.
He was the final player to be trimmed from the squad ahead of France's victorious World Cup campaign on home soil in 1998.
A statement from Forest said: "The club would like to thank Martin for all his efforts during his time at The City Ground and wish him well for the future," before releasing a second statement confirming their new appointment.
"Nottingham Forest are delighted to announce that Sabri Lamouchi has been appointed as the club’s new head coach," said the club.
"He led the Ivory Coast to the 2014 World Cup as the top-ranked side in Africa and the quarter-finals of the 2013 African Cup of Nations, and won the Qatari Cup and reached the Asian Champions League semi-finals during his time at El Jaish SC.
"[Lamouchi] will be assisted at Forest by six new members of staff who will support the first team."