I think we mainly use bucată with the meaning of unit, as in a w̶h̶o̶l̶e̶s̶o̶m̶e̶ complete thing in the sense of usable on its own. And piesă as a part of something, not really useful on its own. But you can see how this scenario is right at the limit. We think of the piece of cake as usable without the whole cake, you can eat it on its own.
Roughly we use o bucată de for a piece of (piece of wood) and piesă for part of (car parts).