Motivated by studies on 4d black holes and q-deformed 2d Yang–Mills theory, and borrowing ideas from compact geometry of the blowing up of affine ADE singularities, we build a class of local Calabi–Yau threefolds (CY 3) extending the local 2-torus model O ( m ) ⊕ O ( − m ) → T 2 considered in [C. Gomez, S. Montanez, A comment on quantum distribution functions and the OSV conjecture, hep-th/0608162] to test OSV conjecture. We first study toric realizations of T 2 and then build a toric representation of X 3 using intersections of local Calabi–Yau threefolds O ( m ) ⊕ O ( − m − 2 ) → P 1 . We develop the 2d N = 2 linear σ-model for this class of toric CY 3s. Then we use these local backgrounds to study partition function of 4d black holes in type IIA string theory and the underlying q-deformed 2d quiver gauge theories. We also make comments on 4d black holes obtained from D-branes wrapping cycles in O ( m ) ⊕ O ( − m − 2 ) → B k with m = ( m 1 , … , m k ) a k-dim integer vector and B k a compact complex one dimension base consisting of the intersection of k 2-spheres S i 2 with generic intersection matrix I i j . We give as well the explicit expression of the q-deformed path integral measure of the partition function of the 2d quiver gauge theory in terms of I i j . A comment on the link between our analysis and the construction of [N. Caporaso, M. Cirafici, L. Griguolo, S. Pasquetti, D. Seminara, R.J. Szabo, Topological strings, two-dimensional Yang–Mills theory and Chern–Simons theory on torus bundles, hep-th/0609129] is also given.