El Paso cops are investigating a breach in jailhouse security … they want to know how in the world Wiz Khalifa managed to sneak a selfie while he was in lockup.

We broke the story … Khalifa was busted early Sunday at an airport security checkpoint for trying to carry weed on a plane.  He was hauled off to jail … where he took a selfie and tweeted it out.

Now we’re told police brass have launched an investigation because inmates are NOT allowed to take pics in the jail with their phones.  Cops want to know if Khalifa was left unsupervised or if one of the jailers was a star f-er and facilitated the pic.