Hi Jaanus,
I think the preferred agent is a contact parameter ("_LastConnOper" or something like this, I believe), which you can actually add/modify in the call in IVR. So within IVR customizer you can implement a logic, which will implement your required window logic.
One of my customer wanted to implement similar logic, however, then it appeared that it would influence SLA negatively more than expected.
Regards,
Dawood.