The sprinklers probably eventually failed. Nevertheless, they certainly worked for a time, people were fighting it the whole time and it nearly collapsed anyway. They probably had a tougher time fighting the upper floors, but fortunately, those aren't carrying most of the building's weight.
NIST determined that diesel fuel did not play an important role, nor did the structural damage from the collapse of the twin towers, nor did the transfer elements (trusses, girders, and cantilever overhangs). But the lack of water to fight the fire was an important factor. The fires burned out of control during the afternoon, causing floor beams near Column 79 to expand and push a key girder off its seat, triggering the floors to fail around column 79 on Floors 8 to 14. With a loss of lateral support across nine floors, Column 79 soon buckled – pulling the East penthouse and nearby columns down with it. With the buckling of these critical columns, the collapse then progressed east-to-west across the core, ultimately overloading the perimeter support, which buckled between Floors 7 and 17, causing the entire building above to fall downward as a single unit. The fires, fueled by office contents, along with the lack of water, were the key reasons for the collapse.
Not nearly as fun of a story as a massive conspiracy, eh?