Success! I found a pupa tucked away at the end of a tunnel. Turns out that the miner is a fly, probably Chromatomyia syngenesiae (Agromyzidae) (a.k.a. Phytomyza syngenesiae). This species is widespread and occurs most frequently on sow thistle (Sonchus oleraceus) — exactly where I found it.
Pupa removed from its mine. The spiracles are visible to the lower left.
There's a maggot feeding away in its mine at the top right.
There's a maggot feeding away in its mine at the top right.