We conduct a tomographic inversion for the 3-D P-wave velocity structure in the lower crust and uppermost mantle of the Sichuan-Yunnan region in the southeastern margin of the Tibetan Plateau. A total of 43,450 reliable arrival times of P waves are picked from over 300,000 regional seismic records using an automatic algorithm based on deep learning. A two-stage iterative inversion process is adopted in which events are relocated in the process, leading to a significant reduction in traveltime residuals. A statistical resolution matrix analysis suggests that our model has an optimal spatial resolution length of ~0.4° in the lower crust and ~0.2° in the uppermost mantle. Our 3-D model shows that both the lower crust and uppermost mantle in the region are characterized by strong lateral heterogeneities. The unusually low velocities in the lower crust may indicate the existence of lower crustal flow, whereas the high velocity anomalies in the uppermost mantle in and around the Sichuan-Yunnan Rhombic Block may be an important factor in preventing the ductile materials in the lower crust moving eastward. Our model also indicates a coupling between the surface deformation and the material flow in the lower crust. Finally, the lower crustal flow may influence the materials immediately below the Moho interface beneath the Sichuan-Yunnan Rhombic Block, and the crust-mantle transition zone in the eastern margin of Songpan-Ganzi Block may be influenced by both the lower crustal flow and the upwelling warm materials from below.