In some cases airlines will follow the "what goes around comes around" principle and will loan or sell parts, and consumables like tires, to another operator that is "AOG" (Aircraft On Ground) to the extent they can without jeopardizing their own operation.
What that means is, in an airline's spares inventory it will have a baseline minimum inventory requirement of components to cover its own AOG situations, things like spare actuators, servos, pumps and other odds and ends, called "AOG stock". If someone on the airport is hard up and approaches you, and you have the part but it's part of your own AOG stock, you won't lend or sell it because of the risk of your own AOG situation arising before you can replace the AOG unit you loaned out or sold.
If it's part of your larger non-AOG spares inventory, and you can afford to part with it temporarily, you might do so, and you may agree to loan it or sell it. That's if you operate the same airplanes and have similar parts stocks with the same part numbers. And airlines that operate the same fleets do buy and sell spares from each other, wheeling and dealing from time to time.
What happens probably more often is the stranded operator will have the required parts shipped "AOG" from either its own spares stock, from an OEM's spares stock from the nearest depot (OEMs will normally maintain spares depots at key locations worldwide) or possibly from the supplier of the part itself (both the OEM and the larger parts suppliers will have their own AOG spares support). Whoever is fastest (or cheapest if time is less critical). Often if the part is fairly small, and will fit in a Lear or Citation, the airline (or the OEM if it's something under warranty, and the operator is an important customer) will charter a corporate jet to fly the part to where it's needed (this is done a lot in the corporate world).
In the case of that UPS flight, it's more than just the tire replacements; wheel unit fuse plugs, or the wheels themselves, probably had to be replaced and a number of special inspections had to be done, so even if there were tires on the spot, the airplane was probably stuck there overnight anyway.
For the tires, say they were Goodyears. UPS might have had a set shipped from the nearest Goodyear distributor, which is in Dubai, which for an AOG would have probably would have arrived that evening or overnight. If there was another airline on the field with the same tires, UPS could have tried to buy a set from them, but they'd have to get lucky and find someone with the same PN tires that were surplus to their own AOG needs and willing to give them up. Or UPS may have just put a set of tires from their own spares on the next UPS flight going to Delhi. Or they may have had Boeing's AOG spares take care of it. They probably would have done whatever was fastest under the circumstances at reasonable cost.
There are also 3rd party spares and logistics companies that some airlines contract to handle all that stuff for them, especially if they are smaller. Like these guys.