Create a PHP function that will basically
SELECT user.userid AS userid, count(thread.*) AS numthreads FROM user, thread WHERE user.userid=thread.postuserid AND NOT FIND_IN_SET($usergroupid, user.membergroupids) AND user.usergroupid!=$usergroupid AND numthreads>=$numthreads
Then with the result set, do your promotion stuff.
This probably is not the EXACT MySQL you'd use, but it should get you started.
When all is said and done, save it into your cron folder, and set a cron job.