In your first example, heptylbenzene, the benzene ring is the parent structure for the preferred IUPAC name because the ring is always the parent structure if the ring and the chain have the same number of substituents that are cited as the principal characteristic group (by means of a suffix or a class name, or implied by a trivial name). The corresponding rule in the current version of Nomenclature of Organic Chemistry – IUPAC Recommendations and Preferred Names 2013 (Blue Book) reads as follows.
P-52.2.8 Selection between a ring and a chain as parent hydride
Within the same heteroatom class and for the same number of characteristic groups cited as the principal characteristic group, a ring is always selected as the parent hydride to construct a preferred IUPAC name. In general nomenclature, a ring or a chain can be the parent hydride (see P-44.1.2.2).
In heptylbenzene, neither the benzene ring nor the heptane chain has any substituents that could be cited as the principal characteristic group. Therefore, the ring is selected as the parent structure.
In 1-phenylpropan-1-ol, however, the propane chain has an $\ce{-OH}$ group, which is the principal characteristic group of this compound and expressed as suffix (‘-ol’). Thus, Rule P-52.2.8 cannot be used. If the ring and the chain have different numbers of substituents corresponding to the principal characteristic group, another rule comes first, which stipulates that the senior parent structure is the one that has the maximum number of substituents cited as the principal characteristic group.
P-44.1 SENIORITY ORDER FOR PARENT STRUCTURES
When there is a choice, the senior parent structure is chosen by applying the following criteria, in order, until a decision is reached. These criteria must always be applied before those applicable to rings and ring systems (see P-44.2) and to chains (see P-44.3). Then criteria applicable to both chains and rings or ring systems given in P-44.4 are considered.
P-44.1.1 The senior parent structure has the maximum number of substituents corresponding to the principal characteristic group (suffix) or senior parent hydride in accord with the seniority of classes (P-41) and the seniority of suffixes (P-43).
Therefore, the propane chain is the parent structure in 1-phenylpropan-1-ol.