Guy balanced on a chair on the rail of a balcony

This is all I can remember from this movie. It might have been a buddy cop or just a buddy movie, but I think one guy loses a bet? Or he gets jumped, I’m not sure, but he ends up getting put in a awkward situation where he is balanced on the rail of this balcony by the rear 2 legs of a chair and there is a bed sheet tied to the chair and pulled taut through the balconies doors to keep him in place. His friend comes in and see’s the situation and has to quickly open the door and grab the blanket before he falls. This one is really bugging me, so any help is appreciated