Voters being turned away: what the electoral commission rules say
Here is some information from the Electoral Commission website that relates to the scandal of people not being able to vote. It covers the 10pm issue.
According to this popwerpoint document from the Electoral Commission, entitled "Polling Station Staff Briefing Session - European Parliamentary election - 4 June 2009":

Electoral Commission rules on 10pm
Close of Poll
Must close at 10 pm
Make sure the doors are closed
Anyone who has been issued with a ballot paper by 10 pm must be allowed to vote
However cannot issue after 10pm, even if elector was in a queue at 10pm
Here's another training quiz for polling station staff (word document):
Q.12 Just after 10pm, a person hands in a completed postal vote. What do you do with it?
Accept the envelope and hand it in at the count with the others
Refuse to accept the envelope
Send the person to the elections office
A.12: If a person hands in a postal vote just after 10pm they should be told that it cannot be accepted as the deadline for receipt of postal votes has passed.
This document, the current handbook for polling station staff (PDF), says:
No one may be issued with a ballot paper after 10pm even if they are inside the polling station and waiting to receive their ballot paper.
Warning from Electoral Commission in "Issues for consideration in connection with a potential combined UK Parliamentary general and local government election in England on 6 May 2010":
9.1 The issues affecting polling stations are highlighted below:-
• Staffing – polling station staff will need to deal with the marking of the register, the CNL and the issue of two ballot papers – consider the implications for staff numbers and the training that will be necessary.
• Voting booths – consider if there is a need to increase the number of booths due to potentially higher turnout and voters taking longer to mark two ballot papers than one.
This training document has a module about "Explain how to deal with a queue of voters as only those issued with ballot papers by 10pm can vote." No details gives.
[...] Commission web site and checked the facts, reporting them on Twitter as he wrote them up on a blog post between 11.53pm and 12.16am. It was another 20 minutes before the BBC found someone from the Electoral Commission to bring into [...]