Valencia spurned a number of clear openings during a goalless first half and Elche made the most of their fortune by taking a 57th-minute lead through Fidel Chavez.
Los Che finally made one of their many opportunities count when their own substitute Juan Bernat drew them level in the 73rd minute, but it was another replacement who decided the game as Elche striker Herrera slotted home the decider six minutes from time.
The result lifts Elche on to 17 points and level with Valencia, who have now lost four of their last six Primera Division matches.
It should have been a completely different story for Miroslav Dukic's men, though, and they only have themselves to blame after failing to capitalise on their numerous openings.
Ricardo Costa contrived to hit a great chance against the bar in the 16th minute and Federico Cartabia, Jeremy Mathieu, Dorlan Pabon twice and Sergio Canales all tried their luck before the break, with a mixture of indifferent finishing and good goalkeeping from Manu Herrera denying them.
It was a similar story after the break, with Javi Fuego heading a free-kick just wide of the near post for the visitors in the 52nd minute.
Five minutes after that Valencia were trailing as Fidel did superbly to contort his body to get on the end of Edu Albacar's driven cross and send a glancing header in off the far post.
Valencia continued to create - and miss - chances after that, with Jonas shooting over before the Brazilian striker was denied by Manu when one-on-one. The rebound fell to Pabon but his header was cleared off the line.
Soon after that Dukic decided to throw Bernat into the action, Pabon the man to make way, and the move paid immediate dividends with the sub equalising seconds after his arrival.
Manu did well to save after Bernat had acrobatically volleyed a deep cross goalwards, but the rebound went back to the 20-year-old and he thumped home a left-footed shot.
Valencia pushed for a winner but, after Manu had parried a shot from Helder Postiga, it was Elche who snatched the points when 22-year-old Herrera - who had only been on the pitch five minutes - got in the end of Ferran Corominas' pass into the area and fired a low shot across Diego Alves and into the net.