diff --git a/include/class.ticket.php b/include/class.ticket.php
index 17d2c56b3545733d3569261eacb1d8bd79328070..53614c5a5828e2e95e60c9bed1d9655927c6cdeb 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -1651,6 +1651,14 @@ class Ticket {
         $this->logNote('Ticket Updated', $vars['note'], $thisstaff);
         $this->reload();
 
+        //Clear overdue flag if duedate or SLA changes and the ticket is no longer overdue.
+        if($this->isOverdue()
+                && (!$this->getEstDueDate() //Duedate + SLA cleared
+                    || Misc::db2gmtime($this->getEstDueDate()) > Misc::gmtime() //New due date in the future.
+                    )) {
+            $this->clearOverdue();
+        }
+
         return true;
     }