Goals by Enner Valencia and Mauro Zarate put the Hammers in control of the third qualifying round before James Collins's dismissal changed the game.
Fernando Boldrin made it 2-1 before debutant Angelo Ogbonna headed past his own keeper while attempting to clear.
West Ham now face a tough test in the second leg in Romania on 6 August.
A section of home fans at Upton Park vented their frustration by booing at the final whistle.
The Hammers had been control for almost an hour before Collins's red card turned the tie upside down and left Slaven Bilic's side with it all to do to reach the play-off round.
They also lost Valencia to a knee injury to compound Billic's problems.
Having required penalties to see off Birkirkara in Malta in the previous round, West Ham are not making life easy for themselves in Europe.
They qualified for the Europa League through the Fair Play League but have now had three players sent off in five Europa League games - one in every round.
Forward Diafra Sakho was sent off against Lusitanos in the first qualifying round while defender James Tomkins was suspended against Astra after being red carded in Malta.
Collins, who had already been booked, could have few complaints after pulling Constantin Budescu's shirt in the 59th minute.
The Hammers should have been more than 2-0 up by that stage, Ogbonna and Mauro Zarate both frustrated by keeper Silviu Lung Jr.
As if losing a 2-0 lead was not bad enough, West Ham lost goalscorer Valencia to what looked like a serious injury.
The Ecuador forward was carried off on a stretcher soon after falling awkwardly, moments after defender Joey O'Brien had gone off with a suspected hamstring problem.
Valencia's powerful header had set the tone for a dominant Hammers first-half performance before the hosts imploded.
West Ham manager Slaven Bilic: "We were dominating the game. It was a very frustrating evening because we played well until the moment we had a player sent-off. We had chances to score the third goal.
"It was a professional foul from Collins and I can't blame him [referee]. The second yellow was harsh.
"We definitely played well in the first hour, but the game lasts 90 minutes and we had to react better to going down to 10 men."
West Ham's hopes of qualifying for the Europa League group stage suffered a setback as they were held after leading 2-0 against Romania's Astra Giurgiu.