We investigate how sedimentary systems respond to tectonic uplift during the last stages of infilling of a foreland basin. Massive conglomeratic deposits characterize the last stage of basin fill in the Jaca basin, the western portion of the South Pyrenean foreland. We conduct detrital zircon U–Pb geochronology in a 3000 m thick Cenozoic section containing the transition from deltaic to alluvial environments with the aim of reconstructing changes of provenance in this key stage of evolution of the basin. The last conglomeratic deposits of the basin belong to the San Juan de la Peña alluvial fan, which has previously been assigned an early Oligocene age. Our results show the presence of earliest Miocene detrital zircons at the base of the fan. Zircon double-dating reveals identical U–Pb and (U–Th)/He ages, which is indicative of a volcanic origin for these zircons. We therefore conclude that this fan was deposited during early Miocene times. Our data establish a new chronological framework for deformation and sedimentation in the South Pyrenean foreland, with strong implications for the dynamics and palaeogeography governing the last episodes of basin fill. Our results support synchronous sedimentation in the Jaca piggy-back basin and in the autochthonous Ebro basin during the last stages of Pyrenean compression in the Miocene. This work emphasizes the tectonic controls on the configuration of the drainage basin and gives insights into the evolution of the drainage network in internally drained basins. Supplementary material: S1: Extended Zircon U-Pb LA-ICP-MS methodology. S2: Reduced detrital zircon U-Pb dataset for all analysis. S3: All age spectra. S4: zHe data. S5: Sample location for the analyzed samples are available at: https://doi.org/10.6084/m9.figshare.c.4507073