This might sound dumb, but if the phone number belongs to someone else now, could you just call/text them and explain the situation and (eventually) ask them to read you the code or something? Admittedly it'd sound suspicious as heck, but if you're willing to provide sufficient proof of your identity and somehow offer a reward in a safe manner, the person might understand and be willing to help? You'd have to be pretty smooth about it, but it seems worth preparing for and giving it a try.
Alternative idea: If you're really desperate, you could even try to dig up the phone number owner's address and show up at their door or something and explain it that way. (Note I'm not recommending these per se; I'm just pointing out what's possible. Obviously be very careful to consider everything before doing such a thing.)