The "lengthy" discharge by Thames Water killed more than 1,400 fish near Gatwick, a court heard.