The Terrapins (4-0) trailed by 13 with 14 minutes left and were locked in a tie with 1:26 remaining before coming back against their in-state foe.
It was tied at 66 when Towson guard Deshaun Morman missed a shot and Trimble was fouled getting the rebound.
Trimble made two free throws with 35.9 seconds left. After Mike Morsellmisfired for the Tigers, Terps freshman Anthony Cowan was fouled and sank one of two shots for a three-point cushion.
Towson's last chance faded when Morman missed a 3-pointer and Kevin Huerter made two fouls shots on the other end.
Trimble went 4 for 15 from the floor but was 16 for 17 at the foul line.
Morsell led the Tigers (2-1) with 17 points and Morman had 15. Towson is 0-13 against the Terrapins.
The Tigers outrebounded Maryland 46-33 but were outscored 26-15 at the foul line.
Towson opened the second half with a 13-2 run to move in front 49-36 with 14:27 remaining. Maryland missed its first seven field-goal tries before Trimble ended the dry spell with a 3-point play.
That ignited a 12-1 run that got the Terrapins to 50-48. The Tigers then expanded their lead to 56-51 before Trimble made two free throws and Jared Nickens popped a long-range jumper to tie it.
Soon after that, Trimble hit a 3 from the corner to put Maryland up 61-58, its first lead since 27-26 late in the first half.
The matchup was a campus-site game in the Barclays Center Classic, which does not put the teams in brackets until the action shifts to New York and Towson on Nov. 25.