Fly (Thistle gall fly) Urophora stylata

Kingdom: Animalia
Phylum: Arthropoda
Class: Insecta
Order: Diptera
Family: Tephritidae
Genus: Urophora
Species: U. stylata
Binomial name: Urophora stylata
Common name: Scotch thistle gall fly, Bull Thistle Gall Fly, Bull thistle seed head gall fly.

Urophora stylata is a species of gall fly in the genus Urophora and is a biocontrol agent of the thistles in genus Cirsium or Carduus. Urophora stylata was released into New Zealand to attack thistles. It prefers the Scotch thistle Cirsium vulgare but occasionally attacks the flower heads of the Californian thistle but does not produce a gall.

Urophora stylata is somewhat smaller than a house fly. The body is light grey in colour with a light brown to yellow scutellum (located on the back behind the head). The wings are clear with each wing having an "IV" marking.
Female flies lay eggs on developing flower buds. After one week the larvae hatch and burrow into the centre of the seed head and devour the developing seed and induce gall tissue production. Galls are an abnormal swelling or deformation of plant tissue caused by insects, mites, microorganisms or injury. The Urophora stylata gall feels like a hard walnut-sized stone in the centre of the flower head. The larvae are pale coloured and are 3 to 5 mm long. Five to over twenty larvae can be found in each gall.
Galled flower heads, containing developing larvae, are present at the beginning of summer and persists through winter. The presence of larvae in the developing seed head can reduce seed production by up 60%.
Adults emerge from the previous year's seed heads in late spring to mid-summer.

Photo of a female fly. It notable for its long ovipositor relative to its body size.
Female Thistle Gall Fly fly Urophora stylata 2-001.jpg 

Female Thistle Gall Fly fly Urophora stylata.-001.jpg 

Thanks to Wikipedia for text and information: https://creativecommons.org/licenses/by-sa/3.0