Than I am guessing that since he takes the keeper status he can use his hands. It was not offside. Then the second goal that Inzaghi scored must have been way offsides, according to your silly rule.
You clearly don't understand the rule. The defender on the line was the last man back, Trezeguet was infront of everybody except him, therefore he is offside. In this situation the defender takes the keeper's place. Inzaghi was not offside because he was behind Bonera and Bonera played the ball across rather than forward.