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 piggyback 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.