Exclusive

The investigation into who gave Mac Miller a deadly dose of pills has resulted in the arrest of a third person.

Law enforcement sources tell TMZ, Stephen "Stevie" Walter was arrested Monday in Los Angeles. According to docs, Walter was contacted by Cameron James Pettit on the night of September 4, 2018 -- Mac died on Sept. 7 -- asking for "10 blues" ... Percocet pills.

Cops say Mac had texted Pettit the following ...

Mac -- "percs?"

Pettit -- "I got some dilaudid 2s but that's about it. I could get yellows and blues though"

Mac -- "blues as far as percs?"

Pettit -- "Yeah 30s"

Mac -- "Those are my sh*tttts man"

From there, according to cops, Pettit then contacted Walter to obtain the ten blues. Walter sent a runner to Pettit with the pills -- and Pettit delivered them to Mac at about 2:30 AM on September 5 -- the rapper was found dead on September 7.

The runner was allegedly Ryan Reavis who was arrested earlier this week in Lake Havasu in connection to Mac's death.

During their investigation of Mac's death scene, cops found a magazine in his bedroom covered with blue-colored powder and indentations near a rolled piece of paper and a gift card. Cops say the scene indicated Mac crushed or snorted one or more pills ... only 6 of the 10 pills were recovered.

Pettit clearly knew he was in trouble, according to the docs, he texted a friend after news of Mac's death, "I'm pretty sad and also a little worried." He then sent a link to a TMZ story about Demi Lovato's alleged dealer getting arrested and said, "This is what I'm afraid of ... I feel really guilty ... If I have to go to jail I hope to spend some time with you first."

However, Pettit clearly didn't learn his lesson, because cops say less than a month later, he bought more "blues" from Walter.

Walter was picked up by the U.S. Attorney's Office on a charge of conspiracy to distribute a controlled substance in connection to Mac's death. It's not his first drug charge, he's currently on supervised release following a 10-year federal drug trafficking sentence.