The first tally put Nigel Farage’s party ahead by a tiny margin, party officials tell the BBC.