Few people would have security access to Picard's quarters, so suspects would be quickly identified thanks to the ship's computer, which keeps track of such things (shown during "In Theory" after Spot escapes Data's quarters).
Enterprise doors are not hinged and do not open inward, so balancing said bucket is a potential obstacle to achieving the prank.
A Starfleet officer would not do that, as they are evolved beyond stupid juvenile stunts.
But what would Picard do? Court-martial, guilty, and the culprit is summarily beamed into space on wide dispersion during a "transporter accident".
Edit: Michael Dorn once said that when standing at the tactical console, always seeing the top of Patrick's head, he thought about throwing an egg at it.