I’m going to say “yes, you could do that” but I can’t confirm for you exactly how. Looking at the CID Lookup feature in FreePBX, you can specify a mySQL source (amongst others) - so it ought to be possible to run a query to find the extension that last called a matched incoming CID.
Perhaps a more experienced user than me could confirm this and expand on the explanation?