D.C. (7-17-4, 25 points) ended a six-game winless skid and won for the second time in eight matches (2-5-1) under new coach Wayne Rooney.
Birnbaum's second goal of the season came off a set piece after NYCFC midfielder Nicolas Acevedo fouled Andy Najar. On the ensuing free kick, Martin Rodriguez was able to put a cross through the defense and Birnbaum finished off a header from the center of the box.
Birnbaum's clutch goal continued the struggles of NYCFC since Valentin Castellanos appeared in his final game on July 23. Since Castellanos was loaned to Girona in Spain's La Liga, the defending champions are 1-5-1 in their past seven matches and their latest loss dropped them into fourth in the Eastern Conference -- 12 points behind first-place Philadelphia and two points behind the New York Red Bulls, who are in third.
Ole Kamara scored in the 24th minute for D.C. United, who went nearly 500 minutes without a goal before scoring twice Sunday against Atlanta.
Heber scored in the 27th for NYCFC, who held possession for 61.1 percent of the match but only mustered three shots on goal and saw Maxime Chanot miss the net in the 78th minute and Matias Pellegrini miss the net in the 87th.
NYCFC goalie Sean Johnson made three saves.
The teams traded goals three minutes apart midway through the first half.
Two minutes after Johnson made a diving stop with his left hand to deny Chris Durkin, Kamara was left alone in the middle of the box for an easy tap-in after getting a cross from Durkin.
Three minutes later, Heber got a cross from Malte Amundsen and ripped a left-footed shot from the center of the box that deflected off Ochoa's hands for a 1-1 deadlock.