If the velocity of your team is impacted by tickets, then it is important to reflect that impact in your sprint planning. There are at least two ways to do so.
Option one: If it isn't possible to assign story points to tickets, then allow your velocity to drop. Don't think of a reduced velocity as a bad thing. The purpose of velocity is to help a team understand how much work to commit to within a period of time. A low velocity team that meets its commitments is preferable to a high velocity team that is highly unreliable in its commitments.
Option two: If it is possible to assign story points to tickets, then count ticket completions toward the team's velocity. Pay attention to the percentage of the team's velocity that is contributed by closing tickets. When planning for a sprint (a new period of work), reserve an appropriate amount of capacity for tickets that the team expects to encounter during the sprint. For example, if velocity is 100 and tickets contribute 40, then only commit to 60 points of non-ticket work. During the sprint, if the team completes non-ticket work and doesn't receive the expected amount of ticket work, then the team can pull additional non-ticket stories into the sprint.
Option two is the preferable approach. Remember that the purpose of velocity is to help teams, when planning a sprint, to avoid committing to more work than can be completed during a sprint. Once commitments have been met, it is always okay for a team to pull additional work into a sprint.
As @Depressive_Bore mentioned, the answers about software maintenance will likely be helpful to you.