Rihanna’s alleged stalker is about to have cops crawling up his cyber ass ... searching his online accounts after RiRi got a terrifying gun threat on social media.
Law enforcement sources tell TMZ … LAPD will scour the records of someone who goes by Alex Mercer and Ralph Alexander on Twitter and Yahoo. We're told the guy posted a selfie of himself on April 30 outside Rihanna's former home.
The next day, he tweeted ... “Should of killed @rihanna a minute back I would be good right now. Sorcery is a weapon I use guns, bout to get a gun license, can’t use my hands.”
Police went to Rihanna's house, but he was gone by the time they arrived. So, now they're tracking him down electronically -- through phone, computer, and social media records.