Slim 400 Ambushed by Masked Gunmen After Drive-By Shooting

687b48c4c0c14b6a97c01f857ac11cae_md.jpg

Slim 400 got shot at by gunmen in a passing vehicle, but then the masked attackers hopped out to try to finish the job ... TMZ has learned.

Sources close to the rapper tell TMZ ... Slim was on the phone with his Ice Watar label business partner, Mud Dollaz, Friday night in Compton when the shooting occurred. 

Mud called Slim to check in because he was waiting for him at the studio, and the last thing he heard the rapper say was "oh sh*t."

After that, TMZ says Dollaz heard a series of gunshots for several seconds ... and then a female voice screaming for Slim to keep his head up, so he knew he'd been hit.

Eyewitnesses on the scene tell TMZ the people who shot at the rapper drove by in a black vehicle spraying bullets, but then actually stopped and jumped out to shoot more at 400 before getting back in to drive away. They were wearing masks.

Slim 400 was shot around 8:30 PM Friday night and suffered multiple gunshot wounds. He took 9 bullets to his body ... to his upper and lower back, his jaw and the top of his head. He's in stable condition following surgery, and miraculously -- is expected to make a full recovery in coming weeks.