The thermodynamic theory of thin lubricant film melting, confined between two hard rough solid surfaces, is built using the Landau phase transition approach. For the description of a melting condition, the order parameter is introduced which is a periodical part of microscopic medium density function. The shear modulus of lubricant is proportional to the order parameter squared. The thermodynamic and shear melting are described consistently. A mechanical analogue of a tribological system in the boundary friction mode is studied. The time dependencies of the friction force, the relative velocity of the interacting surfaces, and the elastic component of the shear stresses appearing in the lubricant are obtained. It is shown that the shear modulus of the lubricant and the elastic stresses become zero in the liquid-like state. The irregular stick-slip mode of melting is described, which is observed in experiments. It is shown that the frequency of stiction spikes in the irregular mode increases with growth of the shear velocity. Comparison of the obtained results with experimental data is carried out.