The Bulldogs, who snapped Army's three-game winning streak, led 66-61 with 1:48 left in regulation, then Matt Gramling's 3 and Andrew Shire's two foul shots forced overtime.
Ellis scored all eight of the Black Knights' points in the second extra period, hitting two 3-pointers and two free throws for an 83-81 Army lead with 43 seconds left.
Martin then entered the game and knocked down his trey.
Ellis made 10 of 20 field goals and 14 of 15 free throws for Army (3-2).
Maryland point guard Melo Trimble, considered a lock to leave the program before struggling in the second half last season, has withdrawn from the NBA draft and will return for his junior season.
Louisville's Chinanu Onuaku, who recently underwent a medical procedure to correct a heart rhythm issue detected during the combine, will keep his name in the NBA draft pool.
Andrew White III will return to the Nebraska men's basketball team next season after removing his name from the NBA draft.