As I understand it you want to alternate between using the iMac display to display a) itself b) a connected MBP c) a simultaneously connected Mac Mini
When you enter Target Display Mode, you do this on the target, i.e. the iMac. There is no option to tell the iMac which connected computer to display, if there are multiple connected.
According to Use your iMac as a display with Target Display Mode in the section Exit Target Display Mode it mentions,
"Your iMac also exits Target Display Mode if you disconnect the cable
that connects the two computers, or if you shut down or sleep either
I have since tested with a Late 2012 iMac 27", Late 2013 15" Macbook Pro, and a Mid 2011, 13", Macbook Air, all running Yosemite.
a) I first connected the MBP and iMac via Thunderbolt cable, and pressed Command-F2 on the iMac. This caused the iMac to go into target display mode and displayed the MBP.
b) I connected the Macbook Air, via a second Thunderbolt cable and this caused the iMac to exit target display mode (as both the Macbook Air and the MBP were not sleeping).
c) I put the MBP to sleep (by closing the lid), and pressed Command-F2 on the iMac. This caused the iMac to go into target display mode and display the Macbook Air.
d) I then alternated target display mode by alternately putting the Macbook Air and the MBP to sleep and pressing Command-F2 on the iMac.
This all seemed to work ok, except one annoyance and that was the iMac seemed to have a dim display every time I entered target display mode. I had to manually adjust the brightness of the iMac display, using the display settings.
NB: From step b) that you cannot have the two computers connected to the iMac awake at the same time and have the iMac in Target Display Mode. At least one of the computers connected must be sleeping. The linked Apple support page fails to mention that.