Metallic nanowires (NWs) are sensitive to heat treatment and can split into shorter fragments within minutes at temperatures far below the melting point. This process can hinder the functioning of NW-based devices that are subject to relatively mild temperatures. Commonly, heat-induced fragmentation of NWs is attributed to the interplay between heat-enhanced diffusion and Rayleigh instability. In this work, we demonstrated that contact with the substrate plays an important role in the fragmentation process and can strongly affect the outcome of the heat treatment. We deposited silver NWs onto specially patterned silicon wafers so that some NWs were partially suspended over the holes in the substrate. Then, we performed a series of heat-treatment experiments and found that adhered and suspended parts of NWs behave differently under the heat treatment. Moreover, depending on the heat-treatment process, fragmentation in either adhered or suspended parts can dominate. Experiments were supported by finite element method and molecular dynamics simulations.