you could always load the query strings (the $sql stuff) into a session array and as they are run change a flag, delete them from the array etc. Then as each iframe loads, they start the session and check for an un-run query.
does that make sense.
the only risk is that 2 might run the same query so maybe each iframe could "know" which to run if they had a sense of who they are - ie hardcoded in the iframe script, passed as a get (which I know you are trying to avoid).
Maybe think about this for a bit, and post further ideas for us to play around with. What type of queries are you running, what happens afterwards?