Inelastic neutron scattering experiments and transmission electron microscopy have been used to study a single crystal of the Ni2MnGa shape memory Heusler alloy in a wide temperature range covering the parent phase (T>T-1=265 K), a recently discovered premartensitic (T-1>T>T-M) and martensitic (T<T-M=220 K) phase regions. A temperature dependent anomaly in the TA(2) phonon dispersion in the parent phase was observed and related to the phase transformations. The premartensitic phase involves a transverse modulation of the parent cubic structure with a simple periodicity of 1/3 [1 1 0]. The approximately tetragonal lattice of the low-temperature martensite is distorted by transverse modulations with incommensurate wave vectors [zeta(M) zeta(M) 0] and [2 zeta(M) 2 zeta(M) 0], zeta(M) approximate to 0.43. The observed phenomena are attributed to electron-phonon interactions and anharmonic effects.