Say you have placed a webpart on a list page ( AllItems.aspx). The webpart queries the same list but if you use the SPContext to get an instance of web you end up not seeing all the items within that list.
To solve this problem , create a new instance of site,web and use it in the webpart. This solves the problem.
Guid siteID = SPContext.Current.Site.ID;
Guid webID = SPContext.Current.Web.ID;
using (SPSite site = new SPSite(siteID))
using (SPWeb web = site.OpenWeb(webID))
//peform your function