A Compactness Result for Differentiable Functions with an Application to Boundary Value Problems