Jason O'Halloran sliced the gap to Josh Brookes to just seven points after triumphing in a thrilling Race 1 at Brands Hatch.