Drawing order of Objects in an Arraylist

This is maybe not a question of the Z value but of the dragging itself.

While you drag you should set a boolean dragging to true.

void mousePressed() {
    ........
    ........
    dragging = true; 
}

When dragging is true, your program should not be allowed to pick up another piece at all (use an if-clause like if(! dragging) { … before start dragging ). No matter what the Z is.

and then

void mouseReleased() {
    dragging = false; 
}

Chrisir