Leyton Orient 3 Tranmere Rovers 0
But Tranmere, who had looked dangerous in the first half, suffered more away-day misery when central defender Shane Sherriff saw red early in the second half to put paid to their hopes.
Orient made a bright start and on-loan striker Andy Barcham should have scored his first goal for the club on nine minutes. Aiden Palmer sent the striker through, but Danny Coyne in the visiting goal made a fine save.
But the O's took the lead when Gray, who missed the last five matches with a thigh strain, took just 11 minutes to make his mark.
Rovers failed to clear Wayne Corden's left-wing corner and Gray fired home from four yards.
But Tranmere came storming back and forced nine first-half corners as only home keeper Stuart Nelson stood between them and a leveller.
First he denied Gareth Taylor, but his best save came on 32 minutes when Sherriff's shot from the edge of the box took a wicked deflection off Corden, but Nelson tipped the goalbound effort away.
Nelson then denied Paul McLaren as Rovers continued to press.
After the break Orient started on the front foot and Gray forced Coyne into a smart stop, before Sherriff, booked in the first half, picked up a second yellow card for another foul on Barcham.
With a man advantage Orient took control and Thornton went close with a free-kick before Tranmere almost conjured an equaliser out of nothing, when Calvin Zola sent an effort inches past the post.
But ten-man Rovers gradually run out of steam and Thornton scored with a delicious lob from 18 yards six minutes from time, then substitute Demetriou wrapped things up with another in stoppage time.