One of the most critical steps in a multitemporal D-InSAR analysis is the resolution of the phase ambiguities in the context of phase unwrapping. The Extended Minimum Cost Flow approach is one of the potential phase unwrapping algorithms used in the Small Baseline Subset analysis. In a first step, each phase gradient is unwrapped in time using a linear motion model and, in a second step, the spatial phase unwrapping is individually performed for each interferogram. Exploiting the temporal and spatial information is a proven method, but the two-step procedure is not optimal. In this paper, a method is presented which solves both the temporal and spatial phase unwrapping in one single step. This requires some modifications regarding the estimation of the motion model and the choice of the weights. Furthermore, the problem of temporal inconsistency of the data, which occurs with spatially filtered interferograms, must be considered. For this purpose, so called slack variables are inserted. To verify the method, both simulated and real data are used. The test region is the Lower-Rhine-Embayment in the southwest of North Rhine-Westphalia, a very rural region with noisy data. The studies show that the new approach leads to more consistent results, so that the deformation time series of the analyzed pixels can be improved.