Spaniard Ferrer was beaten in an epic five-set match with Andrey Kuznetsov, the Russian emerging victorious 6-7 (5-7) 6-0 3-6 6-3 6-2.
The seventh seed looked to be in command after taking the third set, however, Kuznetsov - who racked up 77 winners in the contest - rallied to dominate the final two sets and seal a shock triumph.
World number 118 Kuznetsov will now take on Argentina's Leonardo Mayer following his four-set success against Cypriot Marcos Baghdatis.
Meanwhile, Gulbis, seeded 12th for the grass court tournament at the All England Club, was defeated in straight sets by Sergiy Stakhovsky of Ukraine 6-4 6-3 7-6 (7-5).
Latvian Gulbis reached the semi-finals of the French Open earlier this month, but produced a below-par performance that included 31 unforced errors as Stakhovsky - victor over Roger Federer at the same stage last year - claimed another scalp to set up a third-round clash with Jeremy Chardy of France, who beat Australia's Marinko Matosevic 6-7 (5-7) 7-6 (9-7) 7-6 (11-9) 4-6 7-5.
While Ferrer and Gulbis made early exits, last-year finalists Andy Murray and Novak Djokovic made no mistake in securing their passage into the third round.
Murray hammered Blaz Rola 6-1 6-1 6-0, with the Slovenian having no answer to the the defending champion.
Next up for Murray is 27th seed Roberto Bautista Agut after the Spaniard overcame Jan Hernych of the Czech Republic 7-5 4-6 6-2 6-2.
Djokovic's progress was far less serene, the top seed needing three hours and 17 minutes to beat Radek Stepanek 6-4 6-3 6-7 (5-7) 7-6 (7-5).
Experienced Czech Stepanek displayed admirable spirit throughout an enthralling encounter, yet Djokovic finally struck the telling blow in a fourth set tie-break to book a third-round meeting with France's Gilles Simon, a straight-sets winner over Dutchman Robin Haase.
Stepanek's compatriot Tomas Berdych enjoyed better fortune as the former finalist came from behind to see off Bernard Tomic 4-6 7-6 (7-5) 7-6 (7-3) 6-1.
Berdych's reward is a third-round clash with Marin Cilic, who produced a similar fightback against Andreas Haider-Maurer of Austria, coming through 3-6 6-1 6-4 6-4.
Bulgarian 11th seed Grigor Dimitrov enjoyed a straightforward victory, cruising into the third round with a 6-3 6-2 6-4 win over Luke Saville, while Ukraine's Alexandr Dolgopolov - Dimitrov's next opponent - overcame Benjamin Becker of Germany 6-7 (4-7) 7-6 (7-0) 6-3 6-4.
Jo-Wilfried Tsonga and Sam Querrey will resume on Thursday after play was stopped for bad light with the duo locked at 4-6 7-6 (7-2) 6-7 (4-7) 6-3 9-9 in the fifth set.
There were also wins for Kevin Anderson, Fabio Fognini and Jimmy Wang on Wednesday.