The matchpoint only tells part of the story. His behaviour was a culmination, about how he felt about Rafter.
He had beaten Rafter 7 times in a row and thrashed in the 1997 davis Cup semifinal, one of his best performances. He had won the first 6-1 and Rafter gave his racquet to the ballkid. That got a lot of people on Rafter's side. This actually got under Sampras' skin as Rafter was taking some of his home advantage. Not only that but Rafter raised his level and fought harder than he had fought before and turned the match around.
Sampras was already ****ed off before the match was over. The overule was just the trigger for him to blow his top.
Who knows how Federer would react if he somehow lost to Roddick in the US Open.